Ext.Direct and Symfony, dsExtDirectPlugin. Testing Implementation
I has long sought a solution that would allow class mapping between JavaScript and PHP. In the manner of AMF, the data exchange protocol between the Flash Player and a server. Calling, client side, methods defined in our servers... This would avoid a lot of repetitive code: listen to an event, collecting data, validating, serialize, transmit and process the response : it's always the same thing...
Solutions do exist. With a Java server, the "Direct Web Remoting" lib seems to offer interesting solutions : we can call java methods in the client side.
Aptana sponsors a solution called ActiveJS, which should be interesting, but I had some difficulties trying to implement. It lacks a real documentation, examples, and I wonder if this library does not rely on the Aptana JavaScript server, Jaxer.
And what about PHP ? Not so much, except of course, RPC !!!...
Calling remote methods, it already exists, this is called "Remote Procedure Call", RPC ...
Zend provides an implementation of a JSON-RPC server, and JSON is a format that sticks to JavaScript (more than XML and XML-RPC, another possible format ), but since I discovered Symfony, I find very difficult to immerse myself in the Zend Framework documentation. I am probably wrong, and I'll have to test the implementation of a JSON RPC exchange, especially since there are many jQuery plugins that make it easy javascript side.
For all these reasons, I was very happy to discover Ext.Direct, and the Symfony plugin that implements this protocol in PHP, dsExtDirectPlugin, written by Daniel Stevens. Ext.Direct, the server side of the well-known Ext-JS javascript lib, from Sencha Group, is JSON-RPC. It exposes an API server-side coded to a Javascript client. But with a bit of syntactic sugar that makes the lib very pleasant to work with.
Mind you, I am not a Symfony guru, nor a Ext-JS specialist . What I propose here is simply an account of the Ext.Direct implementation in Symfony via dsExtDirectPlugin. Furthermore, I am still about to exchange on various forums about this implementation, and it is expected that the code informed here will evolve. So, let's go!