Tools for Silex 2.0+ micro-framework.
You can install silex-tools
with Composer:
composer require lokhman/silex-tools
- Console Application
- Config Service Provider
- RESTful Service Provider
- Application Class
- Route Class
- Twig Service Provider
- Tools Trait
Class that overrides base Silex\Application
class and provides automatic registration of
ConfigServiceProvider
, error handling and Tools Trait.
use Lokhman\Silex\Application as BaseApplication;
class Application extends BaseApplication {
public function __construct(array $values = []) {
$values['config.dir'] = __DIR__.'/../app/config';
parent::__construct($values);
// ...
}
}
Class that overrides base Silex\Route
class and adds support for
SecurityTrait
. You can
enable it with:
$app['route_class'] = 'Lokhman\Silex\Route';
Extended service provider for traditional
TwigServiceProvider
that enables
support for namespaces in special twig.paths
option.
use Lokhman\Silex\Provider\TwigServiceProvider;
$app->register(new TwigServiceProvider(), [
'twig.paths' => [
'PublicBundle' => '/path/to/src/PublicBundle/Resources/views',
],
]);
$app->render('@PublicBundle/default/index.html.twig');
Trait to be included in overridden Silex Application
class. Provides various useful methods to be
used in the container. This trait is automatically included into Application
Container.
use Silex\Application as BaseApplication;
use Lokhman\Silex\Application\ToolsTrait;
class Application extends BaseApplication {
use ToolsTrait;
public function __construct(array $values = []) {
parent::__construct($values);
}
}
Library is available under the MIT license. The included LICENSE file describes this in detail.