Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (18 sloc) 0.653 kb

Sleepy - A Restful Modeler


class Model_User extends Sleepy {

    protected $_data_url = '';

    protected $_data = array(
        'id' => '',
        'username' => '',
        'email' => '',

$user = Sleepy::factory('user');
$user->load(); // Runs a GET method on the $_data_url and updates the data.

$user->username = 'iammerrick'; // Change the user name.

$user->save(); // Posts the updated $_data via to the $_data_url

    ->set_fields($_POST, array('username', 'email'))
    ->save(); // Posts the $_data via JSON to the $_data_url and sets $_data with the JSON response

Jump to Line
Something went wrong with that request. Please try again.