定制 jornatf/laravel-route-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jornatf/laravel-route-generator

最新稳定版本:v1.0.0

Composer 安装命令:

composer require jornatf/laravel-route-generator

包简介

Laravel package to auto-generate routes from static blade view.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel package to auto-generate routes from static blade view.

You can use this package to generated simple page that does not require processing in a controller.

If you like this package you can Buy me a Coffee ☕️

Installation

You can install the package via composer:

composer require jornatf/laravel-route-generator

You can publish the config file with:

php artisan vendor:publish --tag="laravel-route-generator-config"

This is the contents of the published config file:

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' => [],
];

Usage

To start and depending on the configurations, you must create in resources\views, the folder with the same name as the value of view_base_path (default: static).

Then you'll have:

resources/
├─ views/
│  ├─ static/
│  │  ├─ about.blade.php
│  │  ├─ contact.blade.php

Here the routes will be generated:

Method URL Route name
GET /about static.about
GET /contact static.contact

You can then check the generation of the routes with the Artisan command:

php artisan generated-route:list

Prefix

You can add prefix to your route group in the config file, like this:

'url_prefix' => 'my_prefix',

Middlewares

You can add middlewares to your route group in the config file, like this:

'middlewares' => ['auth:sanctum'],

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-07