This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Home
This is a basic PHP class for accessing Ruby on Rails REST APIs in an ActiveResource style of coding. The benefit is easier use of RoR-based REST services without having to roll your own CURL-based client each time. Hopefully this class saves a few people some time coding in PHP against RoR-based REST services. It’s by no means an exhaustive port, and some methods are missing, but it does try to cover all the basics.
Note: You will need the php curl extension installed on your system. On Ubuntu, you can install them with:
sudo apt-get install php5-curl
Usage
<?php
require_once ('ActiveResource.php');
class Song extends ActiveResource {
var $site = 'http://localhost:3000/';
var $element_name = 'songs';
}
// create a new item
$song = new Song (array ('artist' => 'Joe Cocker', 'title' => 'A Little Help From My Friends'));
$song->save ();
// fetch and update an item, chaining statements
$song->find (44)->set ('title', 'The River')->save ();
// fetch and update, line by line
$song->find (44);
$song->title = 'The River';
$song->save ();
// get all songs
$songs = $song->find ('all');
// delete a song
$song->find (44);
$song->destroy ();
// custom method
$songs = $song->get ('by_year', array ('year' => 1999));
?>






