Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
PHP
branch: master

merge release/v0.0.9 into master

latest commit 7221292414
Jose Lorenzo Rodriguez authored
Failed to load latest commit information.
Model/Datasource fixing warning
.semver
README.md Update README.md

README.md

Installation

app/Config/bootstap.php

<?php
CakePlugin::load('Rest');
?>

Database config

<?php
class DATABASE_CONFIG {

        public $sample = array(
                'datasource'            => 'Rest.RestSource',
                'host'                  => 'http://api.example.com',
                'format'                => 'json',
                'encoding'              => 'utf-8',
        );

}
?>

Examlpes

Cake inflection REST endpoint

<?php
class User extends AppModel {

        public $useDbConfig = 'sample';

        public $remoteResource = 'users';

}
?>
User::find('all')               == GET    http://api.example.com/users.json
User::read(null, $id)           == GET    http://api.example.com/users/$id.json
User::save()                    == POST   http://api.example.com/users.json
User::save(array('id' => $id))  == PUT    http://api.example.com/users/$id.json
User::delete($id)               == DELETE http://api.example.com/users/$id.json

More to come later

Something went wrong with that request. Please try again.