oaugustus / direct-silex-provider
An ExtJS Direct service provider for Silex.
dev-master
2015-03-02 14:49 UTC
Requires
- php: >=5.3.3
- silex/silex: 1.*
This package is auto-updated.
Last update: 2024-10-29 04:47:18 UTC
README
An ExtDirect service provider for Silex.
Installation
Through Composer:
{ require: { "oaugustus/direct-silex-provider": "dev-master" } }
Usage
To get up and running, register DirectExtension
and
manually specify the bundles directories that will be the controllers exposed
to ExtDirect.
Register the DirectServiceProvider;
// app.php ... $app->register(new Direct\DirectServiceProvider(), array());
Expose the controllers.
// app.php ... // method call without formHandler $app->post('/controller/method', function() use($app){ return $app["request"]->get("name"); })->direct(); // method call with formHandler $app->post('/controller/secondMethod', function(){ })->direct(true);
Add the api call into your page templates:
<script type="text/javascript" src="{{url('directapi')}}"></script>
Ready, now call the remote method from ExtJS code:
Actions.Controller.method({name: 'Otavio'}, function(result, ev){ if (ev.type != 'exception') console.log(result); });