Reputation: 65
On the same server I have a Restler 3.0 API server and also a CakePHP 2.3 application, I want to be able to use CakePHP controller functions from the Restler app. Of course I don't want CakePHP to do any rendering, just to deal with the data.
I considered just doing a https request to the CakePHP app from the Restler api, but this seemed pretty inefficient for the client of the Restler server. I also considered using RabbitMQ to do RPC between the apps but RPC in PHP seemed like too much complexity for something i'm trying to keep simple.
Ideally in Restler i might have something like this:
<?php
class Content {
function post() {
// CakePHP stuff:
$data = array('title'=>'fake data');
$this->Content->create();
if ($this->Content->save($data)) {
return 'ok';
}
}
}
I'm completely open to any good ideas on the best way to achieve this integration.
Upvotes: 0
Views: 951
Reputation: 15363
Whether this is possible really depends on the nature of your environment.
Considerations:
If you just need to repurpose some non-cake specific PHP logic you could always refactor it into its own php class or even just a .php file with some functions in it and share them between your Restler App and your Cake Application.
Upvotes: 0