2017 © Pedro Peláez
 

library silex-rad

Set of dead simple Silex services for faster development

image

gerkirill/silex-rad

Set of dead simple Silex services for faster development

  • Thursday, April 30, 2015
  • by gerkirill
  • Repository
  • 2 Watchers
  • 4 Stars
  • 42 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Silex RAD tools

Set of dead simple Silex services to make development faster., (*1)

Build Status, (*2)

Installation

Using composer, (*3)

{"require": {"gerkirill/silex-rad": "dev-master"}}

Auto-Service

Registers all the classes located in the given directories as services (non-recursively). The constructor of the service will receive single parameter - $app. If you want to pass custom parameters to the constructor - just register the service yourself with the name auto-service would use., (*4)

$app->register(new \SilexRad\AutoService\Provider\AutoServiceProvider(), array(
    'rad.service.directories' => array(
        __DIR__ . '/../src/Service' => array('namespace' => 'Service')
    )
));

E.g. class Service\MyTestService located in Service/MyTestService.php will be accessible with $app['MyTestService']. Config key 'rad.service.directories' contains associative array where keys are paths to the folders you services reside in. The values are associative arrays with settings. Possible settings keys are: - file_extension - '.php' by default, you can change it e.g. to '.inc' if your services use that extension. Files with other extensions will be skipped. - namespace - namespace you services are grouped under, e.g. "Services" or "MyVendor/MyProject/Services", (*5)

Default behaviour can be changed with settings $app['rad.service_name_converter'] and $app['rad.service.registrator']. You can find more details on that under "Extension points" section., (*6)

Auto-Route

Handles routes in a form of '/{controller}/{action}' automatically. Requires controllers to be classes registered as services. {action} part is optional and defaults to "index"., (*7)

// this built-in service provider is required to use auto-route
$app->register(new Silex\Provider\ServiceControllerServiceProvider());
// here you can use AutoServiceProvider to automatically register controllers as services, or you'll have to do it manually
$app->register(new \SilexRad\AutoRoute\Provider\AutoRouteProvider());

E.g. URL my-test/my-example will be processed with MyTest:myExample controller. The controller will be invoked with single parameter - $request. The url will match both GET and POST. If you need more precise route tuning - go create the route manually., (*8)

Auto-Template

Detects twig template name by the current controller and action. Requires controller to be a class registered as service., (*9)

$app->register(new \SilexRad\AutoTemplate\Provider\AutoTemplateProvider());

In your controller you now can do like this:, (*10)

class MyTestController {
    private $app;
    ...
    public function myExample() {
        return $this->app['rad.template.render'](['hello' => 'world']);
    }    
}

And corresponding template would be my-test/my-example.twig under template directory configured for twig., (*11)

Extension points

The Versions

30/04 2015

dev-master

9999999-dev

Set of dead simple Silex services for faster development

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Gerasimenko Kirill

30/04 2015

v1.2

1.2.0.0

Set of dead simple Silex services for faster development

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Gerasimenko Kirill

14/08 2014

1.1

1.1.0.0

Set of dead simple Silex services for faster development

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Gerasimenko Kirill

14/08 2014

v1.1.1

1.1.1.0

Set of dead simple Silex services for faster development

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Gerasimenko Kirill

09/08 2014

v1.0

1.0.0.0

Set of dead simple Silex services for faster development

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Gerasimenko Kirill