Download the PHP package sdv/laravel-endpoint without Composer
On this page you can find all versions of the php package sdv/laravel-endpoint. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-endpoint
Laravel Endpoint
Laravel Endpoint is a CRUD REST API package for Laravel.
Features
- [X] REST CRUD Endpoint scaffolding
- [X] Normalized JSON Response using laravel-fractal
- [X] Simple filtering operations
- [ ] Ability to customize fractal serializer
- [ ] Ability to customize filtering and sorting strategies
- [ ] Elasticsearch / Algolia search
- [ ] Api Documentation (Swagger, API Blueprint)
Installation
You can pull in the package via composer:
Register the service provider.
Replace the render method in .
Testing
Commands Usage
Create a new endpoint
This will create all this files.
- app/Post.php
- app/Repositories/PostRepository.php
- app/Transformers/PostTransformer.php
- app/Http/Controllers/Api/V1/PostController.php
Options:
- --mongo : Generate a Laravel-MongoDB compatible Model. (You need to install https://github.com/jenssegers/laravel-mongodb in your app)
- --module=Modules\Search : Generate all the files under the App\Modules\Search namespace.
Then, you need to register your api routes.
Create a new model class.
This will create the file and insert the minimum boilerplate with filtrable trait.
Optionnaly, you can add the --mongo flag to generate a Laravel-MongoDB compatible Model.
Create a new controller class.
This will create the file and insert the minimum boilerplate.
Create a new repository class.
This will create the file and insert the minimum boilerplate.
Create a new transformer class.
This will create the file and insert the minimum boilerplate.
API Usage
Pagination
Change the selected page
Change the number of items per page
Returns all
Filters
The filter is applied by default.
And Filter
Or Filter
Sort
Includes
Update your transformer to add your include rules, according to fractal docs (http://fractal.thephpleague.com/transformers/)
Then you can include related models on your calls
Error responses
- Bad request (400)
- Unauthorized (401)
- Forbidden (403)
- Not found (404)
- Method not allowed (405)
- Unprocessable entity (422)
- Too many requests (429)
- Server error (500)
Note: The comes with default support for the following exceptions:
- Illuminate\Database\Eloquent\ModelNotFoundException
- Illuminate\Validation\ValidationException
- Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
- Symfony\Component\HttpKernel\Exception\NotFoundHttpException
Credits
License
Laravel Endpoint is open-sourced software licensed under the MIT license
All versions of laravel-endpoint with dependencies
illuminate/database Version ~5.8.0|^6.0|^7.0|^8.0
illuminate/support Version ~5.8.0|^6.0|^7.0|^8.0
spatie/laravel-fractal Version 5.6.1