Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kirschbaum-development/laravel-route-file-macro
A macro for Laravel's Router to load route file(s) directly
https://github.com/kirschbaum-development/laravel-route-file-macro
laravel macros routing
Last synced: 5 days ago
JSON representation
A macro for Laravel's Router to load route file(s) directly
- Host: GitHub
- URL: https://github.com/kirschbaum-development/laravel-route-file-macro
- Owner: kirschbaum-development
- License: mit
- Created: 2018-10-29T22:47:58.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-02-27T16:25:50.000Z (9 months ago)
- Last Synced: 2024-04-28T15:20:58.139Z (7 months ago)
- Topics: laravel, macros, routing
- Language: PHP
- Homepage:
- Size: 27.3 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Route File Macro
[![Latest Version on Packagist](https://img.shields.io/packagist/v/kirschbaum-development/laravel-route-file-macro.svg?style=flat-square)](https://packagist.org/packages/kirschbaum-development/laravel-route-file-macro)
[![Total Downloads](https://img.shields.io/packagist/dt/kirschbaum-development/laravel-route-file-macro.svg?style=flat-square)](https://packagist.org/packages/kirschbaum-development/laravel-route-file-macro)This package allows you to load a routes file directly from the Laravel `Router`.
## Requirements
This package requires Laravel 5.7 or higher.
__Due to Laravel 7's PHP version requirement, if you need support for PHP 7.1, please use version 0.2 of the package.__
## Installation
You can install this macro via composer:
```bash
composer require kirschbaum-development/laravel-route-file-macro
```## Usage
### Single Item
`Route::file` accepts a single file path or `SplFileInfo` object and cannot be used with multiple paths or file objects.
```php
Route::file(base_path('routes/admin/users.php'));$files = File::files(__DIR__.'/routes');
Route::files($files[0]);
```### Multiple Items
`Route::files` accepts an array of file paths or an array of `SplFileInfo` objects and cannot be used with a single path or file object.
```php
Route::files([
base_path('routes/admin/posts.php'),
base_path('routes/admin/users.php')
]);$files = File::files(__DIR__.'/routes');
Route::files($files);
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
### Security
If you discover any security related issues, please email [email protected] or [email protected] instead of using the issue tracker.
## Credits
- [David VanScott](https://github.com/dvanscott)
- [Justin Seliga](https://github.com/jrseliga)## Sponsorship
Development of this package is sponsored by Kirschbaum Development Group, a developer driven company focused on problem solving, team building, and community. Learn more [about us](https://kirschbaumdevelopment.com) or [join us](https://careers.kirschbaumdevelopment.com)!
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.