likai/yii-restful
Composer 安装命令:
composer require likai/yii-restful
包简介
Yii RESTful URL Manager
关键字:
README 文档
README
Requirement
- PHP >= 5.3.0
Installation
Add depend to your project composer.json file
{
"require": {
"yii/yiisoft": "dev-master",
"likai/yii-restful": "dev-master"
}
}
After, run composer update update composer packages
Usage
1. Add topics resource
return array(
'urlManager'=>array(
'class' => 'Likai\\YiiRestful\\UrlManager',
'urlFormat' => 'path',
'showScriptName' => false,
'resources' => array(
'topics',
),
),
);
UrlManager will generate 5 url rules and bind to the controller, like the following
`GET` http://yourdomain/topics => TopicsController::actionIndex
`GET` http://yourdomain/topics/{id} => TopicsController::actionShow
`POST` http://yourdomain/topics => TopicsController::actionCreate
`PUT` http://yourdomain/topics/{id} => TopicsController::actionUpdate
`DELETE` http://yourdomain/topics/{id} => TopicsController::actionDelete
2. Specified parameters
'resources' => array(
'topics',
array('posts', 'only' => array('index', 'create')), // just bind PostsController::actionIndex, PostsController::actionCreate action
array('users', 'except' => array('delete', 'update')), // except UsersController::actionDelete, UsersController::actionUpdate action
),
ChangeLog
Version v1.0.1 and v1.0.2
- Added composer supported
- Added namespace supported
Version v1.0.0
- First release
统计信息
- 总下载量: 97
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2013-08-22