PHPackages                             sprintcube/cakephp-rest - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. sprintcube/cakephp-rest

ActiveCakephp-plugin[HTTP &amp; Networking](/categories/http)

sprintcube/cakephp-rest
=======================

Rest API plugin for CakePHP 3

v1.0.3(7y ago)256.6k6[3 issues](https://github.com/sprintcube/cakephp-rest/issues)[1 PRs](https://github.com/sprintcube/cakephp-rest/pulls)MITPHPPHP &gt;=5.6.0

Since Apr 12Pushed 5y ago8 watchersCompare

[ Source](https://github.com/sprintcube/cakephp-rest)[ Packagist](https://packagist.org/packages/sprintcube/cakephp-rest)[ RSS](/packages/sprintcube-cakephp-rest/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (6)Used By (0)

Rest Plugin for CakePHP
=======================

[](#rest-plugin-for-cakephp)

[![Build Status](https://camo.githubusercontent.com/f781781aa0a5784afb061d3c0ce9f5b407b398ac5baeb25c708a3319d611bf74/68747470733a2f2f7472617669732d63692e6f72672f737072696e74637562652f63616b657068702d726573742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sprintcube/cakephp-rest)[![GitHub license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://raw.githubusercontent.com/sprintcube/cakephp-rest/master/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/cdc642e7d462de048b05eb18fdd9618c30dc1dcd427cfecc44c29ce5438a4b3b/68747470733a2f2f706f7365722e707567782e6f72672f737072696e74637562652f63616b657068702d726573742f646f776e6c6f616473)](https://packagist.org/packages/sprintcube/cakephp-rest)[![Latest Stable Version](https://camo.githubusercontent.com/85ac3502443cda5e76ca8cfffb5f648586e33e30ee5a4449d778bd157d403055/68747470733a2f2f706f7365722e707567782e6f72672f737072696e74637562652f63616b657068702d726573742f762f737461626c65)](https://packagist.org/packages/sprintcube/cakephp-rest)

This plugin simplifies the REST API development for your CakePHP 3 application. It simply converts the output of your controller into a JSON response.

Installation
------------

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

The recommended way to install composer packages is:

```
composer require sprintcube/cakephp-rest

```

After installation, [Load the plugin](http://book.cakephp.org/3.0/en/plugins.html#loading-a-plugin)

```
Plugin::load('Rest', ['bootstrap' => true]);
```

Or, you can load the plugin using the shell command

```
$ bin/cake plugin load -b Rest
```

Usage
-----

[](#usage)

No major change requrires in the way you code in your CakePHP application. Simply, just add one parameter to your route configuration `isRest` like,

```
$routes->connect('/foo/bar', ['controller' => 'Foo', 'action' => 'bar', 'isRest' => true]);
```

And extend your controller to `RestController` and everything will be handled by the plugin itself. For example,

```
