Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9bdfed

Browse files
authored
URI (#53731)
URI parsing and mutation powered by league/uri.
1 parent 36b09b7 commit c9bdfed

File tree

7 files changed

+598
-2
lines changed

7 files changed

+598
-2
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"league/commonmark": "^2.2.1",
3737
"league/flysystem": "^3.25.1",
3838
"league/flysystem-local": "^3.25.1",
39+
"league/uri": "^7.5.1",
3940
"monolog/monolog": "^3.0",
4041
"nesbot/carbon": "^2.72.2|^3.4",
4142
"nunomaduro/termwind": "^2.0",

src/Illuminate/Foundation/Providers/FoundationServiceProvider.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use Illuminate\Support\AggregateServiceProvider;
2828
use Illuminate\Support\Defer\DeferredCallbackCollection;
2929
use Illuminate\Support\Facades\URL;
30+
use Illuminate\Support\Uri;
3031
use Illuminate\Testing\LoggedExceptionCollection;
3132
use Illuminate\Testing\ParallelTestingServiceProvider;
3233
use Illuminate\Validation\ValidationException;
@@ -89,6 +90,7 @@ public function register()
8990
$this->registerDumper();
9091
$this->registerRequestValidation();
9192
$this->registerRequestSignatureValidation();
93+
$this->registerUriUrlGeneration();
9294
$this->registerDeferHandler();
9395
$this->registerExceptionTracking();
9496
$this->registerExceptionRenderer();
@@ -188,6 +190,16 @@ public function registerRequestSignatureValidation()
188190
});
189191
}
190192

193+
/**
194+
* Register the "defer" function termination handler.
195+
*
196+
* @return void
197+
*/
198+
protected function registerUriUrlGeneration()
199+
{
200+
Uri::setUrlGeneratorResolver(fn () => app('url'));
201+
}
202+
191203
/**
192204
* Register the "defer" function termination handler.
193205
*

src/Illuminate/Http/Request.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Support\Str;
1212
use Illuminate\Support\Traits\Conditionable;
1313
use Illuminate\Support\Traits\Macroable;
14+
use Illuminate\Support\Uri;
1415
use RuntimeException;
1516
use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException;
1617
use Symfony\Component\HttpFoundation\InputBag;
@@ -91,6 +92,16 @@ public function method()
9192
return $this->getMethod();
9293
}
9394

95+
/**
96+
* Get a URI instance for the request.
97+
*
98+
* @return \Illuminate\Support\Uri
99+
*/
100+
public function uri()
101+
{
102+
return Uri::of($this->fullUrl());
103+
}
104+
94105
/**
95106
* Get the root URL for the application.
96107
*

0 commit comments

Comments
 (0)