kriit24/project-rest-server
最新稳定版本:v1.2.8
Composer 安装命令:
composer require kriit24/project-rest-server
包简介
Laravel REST API server what based on database models and routing, no controller or other coding is needed
README 文档
README
Project Rest Server is REST-api server for mysql
Its based on Laravel 9+ framework
Installation
# download from packagist
composer require kriit24/project-rest-server
# install package
php artisan project-rest-server:install
Client for server
react-native: project-rest-client
EASY TO USE
//API dynamic request
Route::get('/fetch/{model_name}/{id?}', function (Request $request, $model, $id = null) {
$primary_key = app("App\\Models\\" . $model)->getKeyName();
$to_request = \Project\RestServer\Http\Requests\ToRequest::Get();
$to_request->request->add(['where' => array_filter([$primary_key => $id])]);
$event = new Project\RestServer\Broadcasting\DBBroadcast(
Project\RestServer\Getter\MysqlGetter::class
);
$data = $event->fetch('channel_name', $model, $to_request);
return response(['status' => 'ok', 'count' => count($data), 'data' => $data]);
});
//https://localhost/fetch/object
//https://localhost/fetch/address
//https://localhost/fetch/client
//...
DOCS
config
relationship
usage
统计信息
- 总下载量: 47
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-21