yiisoft /
demo
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | use App\Auth\AuthController; |
||
| 6 | use App\Blog\BlogController; |
||
| 7 | use App\Factory\RestGroupFactory; |
||
| 8 | use App\InfoController; |
||
| 9 | use App\User\UserController; |
||
| 10 | use Yiisoft\Auth\Middleware\Authentication; |
||
|
0 ignored issues
–
show
|
|||
| 11 | use Yiisoft\DataResponse\Middleware\FormatDataResponseAsHtml; |
||
|
0 ignored issues
–
show
The type
Yiisoft\DataResponse\Mid...ormatDataResponseAsHtml 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...
|
|||
| 12 | use Yiisoft\DataResponse\Middleware\FormatDataResponseAsJson; |
||
|
0 ignored issues
–
show
The type
Yiisoft\DataResponse\Mid...ormatDataResponseAsJson 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...
|
|||
| 13 | use Yiisoft\Router\Group; |
||
|
0 ignored issues
–
show
The type
Yiisoft\Router\Group 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...
|
|||
| 14 | use Yiisoft\Router\Route; |
||
|
0 ignored issues
–
show
The type
Yiisoft\Router\Route 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...
|
|||
| 15 | use Yiisoft\Router\UrlGeneratorInterface; |
||
|
0 ignored issues
–
show
The type
Yiisoft\Router\UrlGeneratorInterface 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...
|
|||
| 16 | use Yiisoft\Swagger\Middleware\SwaggerJson; |
||
|
0 ignored issues
–
show
The type
Yiisoft\Swagger\Middleware\SwaggerJson 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...
|
|||
| 17 | use Yiisoft\Swagger\Middleware\SwaggerUi; |
||
|
0 ignored issues
–
show
The type
Yiisoft\Swagger\Middleware\SwaggerUi 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...
|
|||
| 18 | use Yiisoft\Yii\Middleware\CorsAllowAll; |
||
|
0 ignored issues
–
show
The type
Yiisoft\Yii\Middleware\CorsAllowAll 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...
|
|||
| 19 | |||
| 20 | return [ |
||
| 21 | Route::get('/') |
||
| 22 | ->action([InfoController::class, 'index']) |
||
| 23 | ->name('api/info'), |
||
| 24 | |||
| 25 | Route::get('/blog/') |
||
| 26 | ->action([BlogController::class, 'index']) |
||
| 27 | ->name('blog/index'), |
||
| 28 | |||
| 29 | Route::get('/blog/{id:\d+}') |
||
| 30 | ->action([BlogController::class, 'view']) |
||
| 31 | ->name('blog/view'), |
||
| 32 | |||
| 33 | Route::post('/blog/') |
||
| 34 | ->middleware(Authentication::class) |
||
| 35 | ->action([BlogController::class, 'create']) |
||
| 36 | ->name('blog/create'), |
||
| 37 | |||
| 38 | Route::put('/blog/{id:\d+}') |
||
| 39 | ->middleware(Authentication::class) |
||
| 40 | ->action([BlogController::class, 'update']) |
||
| 41 | ->name('blog/update'), |
||
| 42 | |||
| 43 | RestGroupFactory::create('/users/', UserController::class) |
||
| 44 | ->prependMiddleware(Authentication::class), |
||
| 45 | |||
| 46 | Route::post('/auth/') |
||
| 47 | ->action([AuthController::class, 'login']) |
||
| 48 | ->name('auth'), |
||
| 49 | |||
| 50 | Route::post('/logout/') |
||
| 51 | ->middleware(Authentication::class) |
||
| 52 | ->action([AuthController::class, 'logout']) |
||
| 53 | ->name('logout'), |
||
| 54 | |||
| 55 | // Swagger routes |
||
| 56 | Group::create('/docs') |
||
| 57 | ->routes( |
||
| 58 | Route::get('') |
||
| 59 | ->middleware(FormatDataResponseAsHtml::class) |
||
| 60 | ->action(function (SwaggerUi $swaggerUi, UrlGeneratorInterface $urlGenerator) { |
||
| 61 | return $swaggerUi->withJsonUrl($urlGenerator->getUriPrefix() . '/docs/openapi.json'); |
||
| 62 | }), |
||
| 63 | Route::get('/openapi.json') |
||
| 64 | ->middleware(FormatDataResponseAsJson::class) |
||
| 65 | ->middleware(CorsAllowAll::class) |
||
| 66 | ->action([SwaggerJson::class, 'process']), |
||
| 67 | ), |
||
| 68 | ]; |
||
| 69 |
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