phpoetry - Instant AJAX for PHP5 Objects Code
Brought to you by:
salamanders
File | Date | Author | Commit |
---|---|---|---|
cache | 2008-06-19 | salamanders | [r55] |
class | 2009-12-11 | salamanders | [r134] Schema data in individual classes |
example | 2009-03-02 | salamanders | [r99] minimize |
js | 2008-03-25 | salamanders | [r26] |
readme.txt | 2009-12-11 | salamanders | [r134] Schema data in individual classes |
PHPoetry bridges YUI's AJAX functionality and PHP5 object-oriented programming. The PHPoetry Externalize class serves a dual purpose: - To dynamically generate a JavaScript API "hook" from one of your PHP classes - To respond to the calls from the JavaScript Externalize respects method privacy when generating and responding to the API. It also allows batching - calling multiple functions in one HTTP request (although there isn't as of yet a way to automatically do batching from the JavaScript side, possibly soon!) All communications are wrapped in JSON, allowing arbitrary-depth arrays in parameters and replies. utils.php is optional for caching the JavaScript. Feel free to cut it out during development. To get a feel for the usage, load api_example.html and check out the call to load "api_example.php?l=js" - the auto-generated JavaScript hook. Next try making your own api.php using one of your own classes, and you'll start to see how easy it becomes to call as method in the JavaScript layer that seems like it is being called right from the PHP layer! Next you would override the JavaScript callbacks (like the example does with "customSuccess") to do something a bit more interesting with the response.