marcqualie/pimple-aware-controller

A Silex Service Provider to provide Pimple aware controllers

dev-master 2013-05-28 20:52 UTC

This package is auto-updated.

Last update: 2024-10-16 00:10:24 UTC


README

A Silex Service Provider to provide Pimple aware controllers

Install

{
    "require": {
        "marcqualie/pimple-aware-controller": "dev-master"
    }
}

Usage

// Controller/Base.php
namespace Controller;
class Base {
    public function __construct($app)
    {
        $this->app = $app;
    }
    public function display()
    {
        $this->app['twig']->render();
    }
}
// Controller/User.php
namespace Controller;
class User extends Base {
    public function create($app)
    {
        // create user code
        return $this->display();
    }
}
// bootstrap.php
$app->register(new PimpleAwareController\ServiceProvider());
$app->get('/user/create', 'Controller\User::create');

Contributing

Pull requests are welcome at https://github.com/marcqualie/pimple-aware-controller