Topic: PHP / ActiveResource

I have a Rails app that uses Restful design.

I have a ruby client that uses ActiveResource to interact with the rails app using its XML interfaces.

Now I need a PHP client that interacts with my Rails app.

What is the best way to do this??

Is there an 'ActiveResource' library for PHP??

Re: PHP / ActiveResource

Maybe the Akelos framework might be to your liking.

Austin Web Developer
Web Application Development with Ruby on Rails, PHP (w CakePHP or CodeIgniter), ASP.NET (w MVC)

Re: PHP / ActiveResource

I just finished a basic PHP port of ActiveResource which I put online here:

http://code.google.com/p/phpactiveresource/

It's a basic class, not 100% feature-complete but it does cover the basic CRUD functions and executing custom methods (e.g., /person/5/custom_method.xml?key=value), and it uses a fairly similar coding style to the Rails code, for example:

$obj = $objects->find ($key);
$obj->title = 'New title';
$obj->save ();

And you can chain things like this too:

$obj->find ($key)->set ('title', 'New title')->save ();

Anyway, hope it helps save people some time integrating Rails-based services with their PHP code.  Also feel free to make comments, suggestions, improvements, etc.

Cheers,

Lux

Re: PHP / ActiveResource

lux wrote:

I just finished a basic PHP port of ActiveResource which I put online here:

http://code.google.com/p/phpactiveresource/

It's a basic class, not 100% feature-complete but it does cover the basic CRUD functions and executing custom methods (e.g., /person/5/custom_method.xml?key=value), and it uses a fairly similar coding style to the Rails code, for example:

$obj = $objects->find ($key);
$obj->title = 'New title';
$obj->save ();

And you can chain things like this too:

$obj->find ($key)->set ('title', 'New title')->save ();

Anyway, hope it helps save people some time integrating Rails-based services with their PHP code.  Also feel free to make comments, suggestions, improvements, etc.

Cheers,

Lux

That is awesome you took the time to write that. I was thinking of writing a portage between rails and PHP in the next while because I still use PHP quite often, so that just saved a lot of time and lost sleep figuring it out. Thank you for that.