jornatf / laravel-route-generator
Laravel 包,用于从静态 blade 视图自动生成路由。
v1.0.0
2023-11-07 12:08 UTC
Requires
- php: ^8.0.2
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-09-08 10:25:34 UTC
README
一个 Laravel 包,用于从静态 blade 视图自动生成路由。
您可以使用此包生成不需要在控制器中处理的高级页面。
如果您喜欢此包,您可以购买一杯咖啡 ☕️
安装
您可以通过 composer 安装此包
composer require jornatf/laravel-route-generator
您可以使用以下命令发布配置文件
php artisan vendor:publish --tag="laravel-route-generator-config"
这是发布配置文件的内容
return [ /* |-------------------------------------------------------------------------- | View base path |-------------------------------------------------------------------------- | | Specify here the folder containing the blade views for the routes. This | base will not be in the URL. | */ 'view_base_path' => 'static', /* |-------------------------------------------------------------------------- | URL prefix |-------------------------------------------------------------------------- | | Here you can specify a URL prefix. By default the value is null. | */ 'url_prefix' => null, /* |-------------------------------------------------------------------------- | Midlewares |-------------------------------------------------------------------------- | | You can specify the middlewares that should be used for all automatically | generated URLs. | */ 'middlewares' => [], ];
用法
要开始使用,根据配置,您必须在 resources\views
中创建与 view_base_path
值相同名称的文件夹(默认:static
)。
然后您将拥有
resources/
├─ views/
│ ├─ static/
│ │ ├─ about.blade.php
│ │ ├─ contact.blade.php
在此处将生成路由
然后您可以使用 Artisan 命令检查路由的生成
php artisan generated-route:list
前缀
您可以在配置文件中为您的路由组添加前缀,如下所示
'url_prefix' => 'my_prefix',
中间件
您可以在配置文件中为您的路由组添加中间件,如下所示
'middlewares' => ['auth:sanctum'],
测试
composer test
变更日志
有关最近更改的更多信息,请参阅变更日志。
贡献
有关详细信息,请参阅贡献指南。
安全漏洞
有关报告安全漏洞的详细信息,请参阅我们的安全策略。
鸣谢
许可
MIT 许可证 (MIT)。有关更多信息,请参阅许可文件。