stupidlysimple /
php
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * StupidlySimple - A PHP Framework For Lazy Developers. |
||
| 4 | * |
||
| 5 | * @author Fariz Luqman <[email protected]> |
||
| 6 | * @copyright 2017 Fariz Luqman |
||
| 7 | * @license MIT |
||
| 8 | * |
||
| 9 | * @link https://stupidlysimple.github.io/ |
||
| 10 | */ |
||
| 11 | |||
| 12 | /* |
||
| 13 | |-------------------------------------------------------------------------- |
||
| 14 | | The Basic Routes - Route GET / into /home.php |
||
| 15 | |-------------------------------------------------------------------------- |
||
| 16 | | |
||
| 17 | | Requests from / will be served by the file /home.view.php. You can also put |
||
| 18 | | view files (home.view.php) into any directory within the project. |
||
| 19 | | |
||
| 20 | */ |
||
| 21 | Router::get('/', 'home'); |
||
|
0 ignored issues
–
show
|
|||
| 22 | |||
| 23 | /* |
||
| 24 | |-------------------------------------------------------------------------- |
||
| 25 | | Controller & HTTP Middleware Demonstration |
||
| 26 | |-------------------------------------------------------------------------- |
||
| 27 | | |
||
| 28 | | This is to demonstrate using Controller and Middleware with |
||
| 29 | | StupidlySimple framework. Try to go to /hello or /hello/yourname and see |
||
| 30 | | what it shows. |
||
| 31 | | |
||
| 32 | | Middleware is about how our application responds to incoming requests. |
||
| 33 | | Middleware look into the incoming request, and make decisions based on |
||
| 34 | | this request. We can build entire applications only using middleware. |
||
| 35 | | |
||
| 36 | | In this example, the hello middleware will demonstrate filtering a |
||
| 37 | | request, which is the /route/to/be/filtered. Try to go to the url and |
||
| 38 | | see what happen. |
||
| 39 | | |
||
| 40 | */ |
||
| 41 | Router::group('Middleware\Hello@filter', function () { |
||
| 42 | Router::get('/hello', 'hello'); |
||
| 43 | Router::get('/hello/(:any)', 'Controller\Hello@greetWithName'); |
||
| 44 | Router::post('/hello', 'Controller\Hello@greetForm'); |
||
| 45 | Router::get('/route/to/be/filtered', 'hello'); |
||
| 46 | }); |
||
| 47 | |||
| 48 | /* |
||
| 49 | |-------------------------------------------------------------------------- |
||
| 50 | | Administrator Demonstration |
||
| 51 | |-------------------------------------------------------------------------- |
||
| 52 | | |
||
| 53 | | This is to demonstrate using group with the authentication checker. The |
||
| 54 | | middleware will intercept the HTTP request if the user is not logged in. |
||
| 55 | | |
||
| 56 | */ |
||
| 57 | Router::group('Controller\Auth@check', function () { |
||
| 58 | Router::get('/admin', 'admin/home'); |
||
| 59 | Router::post('/updateuser', 'Controller\User@editUser'); |
||
| 60 | Router::get('/deleteuser', 'Controller\User@deleteUser'); |
||
| 61 | }); |
||
| 62 | |||
| 63 | /* |
||
| 64 | |-------------------------------------------------------------------------- |
||
| 65 | | Lazy Routing - Route GET /(:any) into /resources/views/(:any).view.php |
||
| 66 | |-------------------------------------------------------------------------- |
||
| 67 | | |
||
| 68 | | Ever wondered where's the rest of the routes is defined? It is in here, |
||
| 69 | | the wildcard route. |
||
| 70 | | |
||
| 71 | | This is to demonstrate wildcard routing, which allows you to route any |
||
| 72 | | URI into any of the view files. |
||
| 73 | | |
||
| 74 | | The lazy routing must be put at the end of the file or it will override |
||
| 75 | | other route declarations. |
||
| 76 | | |
||
| 77 | */ |
||
| 78 | Router::get('/(:any)', function ($match) { |
||
| 79 | Viewer::file($match); |
||
|
0 ignored issues
–
show
The type
Viewer was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 80 | }); |
||
| 81 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths