| Package Data | |
|---|---|
| Maintainer Username: | vench |
| Maintainer Contact: | nowwrit@mail.ru (Venya) |
| Package Create Date: | 2018-01-29 |
| Package Last Update: | 2018-12-27 |
| Language: | PHP |
| License: | Apache-2.0 |
| Last Refreshed: | 2025-12-03 15:09:48 |
| Package Statistics | |
|---|---|
| Total Downloads: | 4,404 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 1 |
| Total Watchers: | 2 |
| Total Forks: | 1 |
| Total Open Issues: | 0 |
#Lp api rest
This package allows you to create a simple REST API on the basis of standard models (Eloquent) of the Larave 5.x Framework.
##install
##Configure
Add app.php
$app->register(LpRest\RestServiceProvider::class);
//$app->register(LpRest\RestServiceProviderLumen::class); //for Lumen
Add in AppServiceProvider::register
//Set model aliases
app()->afterResolving(CommonRepositoryModelProvider::class,
function(CommonRepositoryModelProvider $mp) {
$mp->addModelAliases('user', \App\User::class);
});
//Change access provider
$this->app->bind(CommonRepositoryAccessProvider::class, ApiAccessProvider::class );
//Change response schema
$this->app->bind(CommonResponse::class, ApiCustomResponse::class );
//Custom routes and etc
$this->app->afterResolving(RestServiceHelper::class,
function(RestServiceHelper $sp) {
$sp->setRouteGroupOptions([
'prefix' => 'api/rest',
//'middleware' => 'auth',
]);
});
##API