https://github.com/paramientos/larasplitter
Laravel Api Splitter - Make your endpoints manageable
https://github.com/paramientos/larasplitter
api laravel laravel-api laravel-route php routes seperate-api-laravel soysaltan split-your-laravel-api
Last synced: 6 months ago
JSON representation
Laravel Api Splitter - Make your endpoints manageable
- Host: GitHub
- URL: https://github.com/paramientos/larasplitter
- Owner: paramientos
- Archived: true
- Created: 2020-10-20T08:25:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-20T13:18:38.000Z (over 5 years ago)
- Last Synced: 2025-11-27T16:32:38.000Z (8 months ago)
- Topics: api, laravel, laravel-api, laravel-route, php, routes, seperate-api-laravel, soysaltan, split-your-laravel-api
- Language: PHP
- Homepage:
- Size: 43 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Decompose your Laravel route files
[](//packagist.org/packages/soysaltan/larasplitter) [](//packagist.org/packages/soysaltan/larasplitter) [](//packagist.org/packages/soysaltan/larasplitter) [](//packagist.org/packages/soysaltan/larasplitter)
While working with Laravel, you may encounter a scenario in which route files need to be separated.In this case you will need to make some changes in the project. This process can often become a chore, I have often faced this problem so I developed a package to help you automate this kind of chore.
## Getting Started
### 1. Install
Run the following command:
```bash
composer require soysaltan/larasplitter
```
### 2. Register (for Laravel < 5.5)
Register the service provider in `config/app.php`
```php
Soysaltan\LaraSplitter\Provider::class,
```
### 3. Publish
Publish config file.
```bash
php artisan vendor:publish --tag=larasplitter
```
### 4. Configure
You can change the settings of your app from `config/larasplitter.php` file
## Usage
```php
php artisan spl:it
```
After this command, you will be asked two questions.
- Please enter a api file name (the filename will be saved with '.api' suffix): **foo**
- Please enter an endpoint name: **foos**
Finally, you will get a message like
- You can find your '**SplitApiFooServiceProvider**' class at '**/path/to/app/Providers'**
- Your '**foo.api.php**' file has located at '**/path/to/routes**'
You can hit the endpoint you have created : **/api/foos**
## Requirements
- Laravel 5.3+
- PHP 5.6.4+
### How it works
**Soysaltan\LaraSplitter\Provider** registers the route file you want to separate under the **app/Providers** folder. This register dynamically does the following:
```php
foreach (glob(base_path('app/Providers/SplitApi*')) as $file) {
$className = basename($file, '.php');
$this->app->register("\App\Providers\\$className");
}
```
Each separate route file is mapped to a provider and registered in the system in this way.
## Changelog
Please see [Releases](../../releases) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email soysaltann@gmail.com instead of using the issue tracker.
## Credits
- [Soysal Tan](https://github.com/soysaltan)
## License
The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.