Skip to content

bryglen/yii-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bryan Tan Yii API

INSTALLATION

Usage

create a class called ApiController or any name you want but must extend the AApiController

class AccountController extends AApiController
{
	public function actionArray()
	{
		 $model = User::model()->find();

		 $response = $this->toArray($model,array(
		 	'user_id' => 'id',
			'username',
			'fullname' => function($model) {
				return $model->first_name . ' ' . $model->last_name;
			}
		 ));

		 $this->sendResponse($response);
	}
}

Enable Audit Logging

in your configuration file add this if you want to enable audit logging in your api call

'components' => array(
	'auditTrail'=>array(
	'class'=>'ApiAuditTrail',
	'enableCreateTable'=>true,
 ),

About

api for yii

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages