Download the PHP package pellerichard/laravel-dynamic-api without Composer
On this page you can find all versions of the php package pellerichard/laravel-dynamic-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pellerichard/laravel-dynamic-api
More information about pellerichard/laravel-dynamic-api
Files in pellerichard/laravel-dynamic-api
Package laravel-dynamic-api
Short Description Laravel Dynamic API
License MIT
Informations about the package laravel-dynamic-api
Laravel Dynamic API
Issue
Implementing multiple CRUD's with different table name and columns could take a lot of hours to make.
Solution
Dynamic API which holds the data within a generic table.
Pros:
- Saves a lot of time
- You can always set new type of data without touching the previous records
- Perfect for Micro sites / Micro services, and for small projects
Cons:
- Slower than standard solutions due to the data saving mechanism.
Installation
Install the package:
composer require pellerichard/laravel-dynamic-api
Publish the config:
php artisan vendor:publish --provider="Pellerichard\LaravelDynamicApi\DynamicApiServiceProvider"
Run the migration:
php artisan migrate
You should now have a config/dynamic-api.php
file that allows you to configure the basics of this package.
Endpoint access:
Default Endpoints:
Retrieve every entities:
GET /api/v1/dynamic-api
Retrieve all entities within a table by table name:
GET /api/v1/dynamic-api?type=people
Retrieve specific entity within a table by type and record_id:
GET /api/v1/dynamic-api?type=people&record_id=1
Create an entity:
POST /api/v1/dynamic-api?type=people&age=32&height=180cm&first_name=John&last_name=Doe
Update a specific entity by type and record_id:
PATCH /api/v1/dynamic-api?type=people&record_id=1&age=33
Manual access:
Available methods on Model
Method: getDataAsArray
Description: Returns the entity's data in array format.
Customization options