Skip to content

Commit 59b0264

Browse files
committed
add namespace to examples
1 parent 83a6de5 commit 59b0264

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"autoload": {
3838
"psr-4": {
3939
"MiladRahimi\\PhpRouter\\": "src/",
40-
"MiladRahimi\\PhpRouter\\Tests\\": "tests/"
40+
"MiladRahimi\\PhpRouter\\Tests\\": "tests/",
41+
"MiladRahimi\\PhpRouter\\Examples\\": "examples/"
4142
}
4243
}
4344
}

examples/Controller.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace MiladRahimi\PhpRouter\Examples;
4+
35
class Controller
46
{
57
public function getAbout()

examples/Middleware.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?php
22

3+
namespace MiladRahimi\PhpRouter\Examples;
4+
5+
use Closure;
36
use Psr\Http\Message\ServerRequestInterface;
47

58
class Middleware implements \MiladRahimi\PhpRouter\Middleware

examples/index.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
use MiladRahimi\PhpRouter\Enums\GroupAttributes;
3+
use MiladRahimi\PhpRouter\Examples\Middleware;
44
use MiladRahimi\PhpRouter\Exceptions\RouteNotFoundException;
55
use MiladRahimi\PhpRouter\Router;
66
use Zend\Diactoros\Response\EmptyResponse;
@@ -12,12 +12,10 @@
1212
use Zend\Diactoros\ServerRequest;
1313

1414
require('../vendor/autoload.php');
15-
require('Controller.php');
16-
require('Middleware.php');
1715

18-
$router = new Router();
16+
$router = new Router('', 'MiladRahimi\PhpRouter\Examples');
1917

20-
// Simple home page
18+
// The home page
2119
$router->get('/', function () {
2220
return 'Homepage!';
2321
});

0 commit comments

Comments
 (0)