dboho/slim3-rest-controller
Composer 安装命令:
composer require dboho/slim3-rest-controller
包简介
Simple REST controller for Slim3
README 文档
README
Dependencies
- dboho/simple-database-api
- slim/slim >= 3.0
- PHP >= 5.5
Usage
// dependencies container $container = $app->getContainer(); $container[TableController::class] = function ($c) { $pdo = new PDO('sqlite:database.db'); $dataAccess = new DataAccess($pdo); return new TableController($dataAccess); }; // routes for tables books, videos and images $app->group('/api/{table:books|videos|images}', function () { // get all entries in books or a subset selected with query-parameters $this->get('', TableController::class . ':getAll'); // get one entry $this->get('/{id:[0-9]+}', TableController::class . ':get'); // add one entry $this->post('', TableController::class . ':add'); // update one entry $this->put('/{id:[0-9]+}', TableController::class . ':update'); // update all entries or a subset selected with query-parameters $this->put('', TableController::class . ':update'); // delete a specific entry $this->delete('/{id:[0-9]+}', TableController::class . ':delete'); // delete all entries or a subset selected with query-parameters $this->delete('', TableController::class . ':delete'); });
Installation
The recommended installation method is via Composer.
In your project root just run:
$ composer require dboho/slim3-rest-controller
统计信息
- 总下载量: 138
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-03-22