Skip to content

Commit 5b96a0e

Browse files
miladrahimiMilad Rahimi
authored andcommitted
rename router to phprouter
1 parent 5bd7e8b commit 5b96a0e

21 files changed

+67
-67
lines changed

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ location / {
4848
After configuration, you can use PhpRouter in your entry point (`index.php`) like this example.
4949

5050
```
51-
use MiladRahimi\PHPRouter\Router;
51+
use MiladRahimi\PhpRouter\Router;
5252
5353
$router = new Router();
5454
@@ -66,7 +66,7 @@ of course, PhpRouter supports plenty of controller types which will be discussed
6666
Following example demonstrates how to define simple routes.
6767

6868
```
69-
use MiladRahimi\PHPRouter\Router;
69+
use MiladRahimi\PhpRouter\Router;
7070
use Zend\Diactoros\Response\HtmlResponse;
7171
use Zend\Diactoros\Response\JsonResponse;
7272
@@ -92,7 +92,7 @@ $router->dispatch();
9292
You can use the following PhpRouter methods to map different HTTP methods to the controllers.
9393

9494
```
95-
use MiladRahimi\PHPRouter\Router;
95+
use MiladRahimi\PhpRouter\Router;
9696
9797
$router = new Router();
9898
@@ -122,7 +122,7 @@ $router->dispatch();
122122
You may need to use other HTTP methods or your custom ones, no worry, there is `Router::map()` method for you.
123123

124124
```
125-
use MiladRahimi\PHPRouter\Router;
125+
use MiladRahimi\PhpRouter\Router;
126126
127127
$router = new Router();
128128
@@ -149,7 +149,7 @@ If your controller is not sensitive about HTTP methods and
149149
it is going to respond regardless to what HTTP method is, the method `Router::any()` is for you.
150150

151151
```
152-
use MiladRahimi\PHPRouter\Router;
152+
use MiladRahimi\PhpRouter\Router;
153153
154154
$router = new Router();
155155
@@ -164,7 +164,7 @@ $router->dispatch();
164164
PhpRouter supports plenty of controller types, just look at following examples.
165165

166166
```
167-
use MiladRahimi\PHPRouter\Router;
167+
use MiladRahimi\PhpRouter\Router;
168168
169169
$router = new Router();
170170
@@ -190,7 +190,7 @@ $router->dispatch();
190190
Using a class for controller could be nice:
191191

192192
```
193-
use MiladRahimi\PHPRouter\Router;
193+
use MiladRahimi\PhpRouter\Router;
194194
195195
$router = new Router();
196196
@@ -212,7 +212,7 @@ The controller class can also have a namespace:
212212
```
213213
namespace App\Http\Controllers;
214214
215-
use MiladRahimi\PHPRouter\Router;
215+
use MiladRahimi\PhpRouter\Router;
216216
217217
$router = new Router();
218218
@@ -236,7 +236,7 @@ Some endpoints have variable parts like IDs in URLs.
236236
We call them the route parameters, and you can catch them with controller parameters with the same names.
237237

238238
```
239-
use MiladRahimi\PHPRouter\Router;
239+
use MiladRahimi\PhpRouter\Router;
240240
241241
$router = new Router();
242242
@@ -266,7 +266,7 @@ $router->dispatch();
266266
In default, route parameters can match any value, but you can define a regular expression for it if you want to.
267267

268268
```
269-
use MiladRahimi\PHPRouter\Router;
269+
use MiladRahimi\PhpRouter\Router;
270270
271271
class BlogController
272272
{
@@ -295,7 +295,7 @@ It uses [Zend implementation](https://github.com/zendframework/zend-diactoros) o
295295
You can catch the request object like the example.
296296

297297
```
298-
use MiladRahimi\PHPRouter\Router;
298+
use MiladRahimi\PhpRouter\Router;
299299
use Zend\Diactoros\ServerRequest;
300300
use Zend\Diactoros\Response\EmptyResponse;
301301
@@ -330,7 +330,7 @@ Your controllers can return a string value as the response, it will be considere
330330
You can also return JSON, plain text and empty responses by provided zend-diactoros package.
331331

332332
```
333-
use MiladRahimi\PHPRouter\Router;
333+
use MiladRahimi\PhpRouter\Router;
334334
use Zend\Diactoros\ServerRequest;
335335
use Zend\Diactoros\Response\EmptyResponse;
336336
use Zend\Diactoros\Response\HtmlResponse;
@@ -367,7 +367,7 @@ $router->dispatch();
367367
Your controllers can redirect user to another url as well.
368368

369369
```
370-
use MiladRahimi\PHPRouter\Router;
370+
use MiladRahimi\PhpRouter\Router;
371371
use Zend\Diactoros\ServerRequest;
372372
use Zend\Diactoros\Response\RedirectResponse;
373373
@@ -427,8 +427,8 @@ it passes the request to next middleware or controller (if there is no more midd
427427
if the header is absent it returns an empty response with `401 Authorization Failed ` HTTP status code.
428428

429429
```
430-
use MiladRahimi\PHPRouter\Router;
431-
use MiladRahimi\Router\Middleware;
430+
use MiladRahimi\PhpRouter\Router;
431+
use MiladRahimi\PhpRouter\Middleware;
432432
use Psr\Http\Message\ResponseInterface;
433433
use Psr\Http\Message\ServerRequestInterface;
434434
@@ -463,7 +463,7 @@ it may assign subdomain dynamically to users like blog hosting services.
463463
In this case, you need to specify domain or subdomain in addition to the URIs in your routes.
464464

465465
```
466-
use MiladRahimi\PHPRouter\Router;
466+
use MiladRahimi\PhpRouter\Router;
467467
use Zend\Diactoros\ServerRequest;
468468
use Zend\Diactoros\Response\RedirectResponse;
469469
@@ -492,7 +492,7 @@ Usually routes can fit in a groups that have common attributes like middleware,
492492
To group the routes you can follow the example below.
493493

494494
```
495-
use MiladRahimi\PHPRouter\Router;
495+
use MiladRahimi\PhpRouter\Router;
496496
497497
$router = new Router();
498498
@@ -521,7 +521,7 @@ In the previous version, there was a `setBaseUri()` method but it's removed in t
521521
You still can have the same functionality with grouping your routes and using prefix attribute.
522522

523523
```
524-
use MiladRahimi\PHPRouter\Router;
524+
use MiladRahimi\PhpRouter\Router;
525525
526526
$router = new Router();
527527
@@ -537,7 +537,7 @@ You can name your routes and use their names to get their information or check c
537537
You can set the route name via `name` parameter or using `useName()` method before defining the route.
538538

539539
```
540-
use MiladRahimi\PHPRouter\Router;
540+
use MiladRahimi\PhpRouter\Router;
541541
542542
$router = new Router();
543543
@@ -557,7 +557,7 @@ Since your application runs through the `Router::disptach()` method,
557557
you should put it in a `try` block and catch exceptions that will be thrown by your application and the router.
558558

559559
```
560-
use MiladRahimi\PHPRouter\Router;
560+
use MiladRahimi\PhpRouter\Router;
561561
562562
$router = new Router();
563563

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
},
2727
"autoload": {
2828
"psr-4": {
29-
"MiladRahimi\\Router\\": "src/MiladRahimi/Router/",
30-
"MiladRahimi\\Router\\Tests\\": "tests/"
29+
"MiladRahimi\\PhpRouter\\": "src/MiladRahimi/PhpRouter/",
30+
"MiladRahimi\\PhpRouter\\Tests\\": "tests/"
3131
}
3232
}
3333
}

src/MiladRahimi/Router/Enums/HttpMethods.php renamed to src/MiladRahimi/PhpRouter/Enums/HttpMethods.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 14:39
77
*/
88

9-
namespace MiladRahimi\Router\Enums;
9+
namespace MiladRahimi\PhpRouter\Enums;
1010

1111
class HttpMethods
1212
{

src/MiladRahimi/Router/Enums/RouteAttributes.php renamed to src/MiladRahimi/PhpRouter/Enums/RouteAttributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 01:38
77
*/
88

9-
namespace MiladRahimi\Router\Enums;
9+
namespace MiladRahimi\PhpRouter\Enums;
1010

1111
class RouteAttributes
1212
{

src/MiladRahimi/Router/Exceptions/InvalidControllerException.php renamed to src/MiladRahimi/PhpRouter/Exceptions/InvalidControllerException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 22:30
77
*/
88

9-
namespace MiladRahimi\Router\Exceptions;
9+
namespace MiladRahimi\PhpRouter\Exceptions;
1010

1111
use Exception;
1212

src/MiladRahimi/Router/Exceptions/InvalidMiddlewareException.php renamed to src/MiladRahimi/PhpRouter/Exceptions/InvalidMiddlewareException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 01:44
77
*/
88

9-
namespace MiladRahimi\Router\Exceptions;
9+
namespace MiladRahimi\PhpRouter\Exceptions;
1010

1111
use Exception;
1212

src/MiladRahimi/Router/Exceptions/RouteNotFoundException.php renamed to src/MiladRahimi/PhpRouter/Exceptions/RouteNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 23:11
77
*/
88

9-
namespace MiladRahimi\Router\Exceptions;
9+
namespace MiladRahimi\PhpRouter\Exceptions;
1010

1111
use Exception;
1212

src/MiladRahimi/Router/Middleware.php renamed to src/MiladRahimi/PhpRouter/Middleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 01:31
77
*/
88

9-
namespace MiladRahimi\Router;
9+
namespace MiladRahimi\PhpRouter;
1010

1111
use Closure;
1212
use Psr\Http\Message\ResponseInterface;

src/MiladRahimi/Router/Router.php renamed to src/MiladRahimi/PhpRouter/Router.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
* Time: 12:23
77
*/
88

9-
namespace MiladRahimi\Router;
9+
namespace MiladRahimi\PhpRouter;
1010

1111
use Closure;
12-
use MiladRahimi\Router\Enums\RouteAttributes;
13-
use MiladRahimi\Router\Exceptions\InvalidControllerException;
14-
use MiladRahimi\Router\Exceptions\InvalidMiddlewareException;
15-
use MiladRahimi\Router\Exceptions\RouteNotFoundException;
16-
use MiladRahimi\Router\Services\Publisher;
17-
use MiladRahimi\Router\Services\PublisherInterface;
12+
use MiladRahimi\PhpRouter\Enums\RouteAttributes;
13+
use MiladRahimi\PhpRouter\Exceptions\InvalidControllerException;
14+
use MiladRahimi\PhpRouter\Exceptions\InvalidMiddlewareException;
15+
use MiladRahimi\PhpRouter\Exceptions\RouteNotFoundException;
16+
use MiladRahimi\PhpRouter\Services\Publisher;
17+
use MiladRahimi\PhpRouter\Services\PublisherInterface;
1818
use Psr\Http\Message\ResponseInterface;
1919
use Psr\Http\Message\ServerRequestInterface;
2020
use ReflectionException;

src/MiladRahimi/Router/Services/HeaderExposer.php renamed to src/MiladRahimi/PhpRouter/Services/HeaderExposer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 22:44
77
*/
88

9-
namespace MiladRahimi\Router\Services;
9+
namespace MiladRahimi\PhpRouter\Services;
1010

1111
class HeaderExposer implements HeaderExposerInterface
1212
{

0 commit comments

Comments
 (0)