dev-master
9999999-devSilex fat cousin
MIT
The Requires
- php >=5.3.3
- silex/silex 1.0.*
- symfony/yaml 2.2.x-dev
- symfony/finder 2.2.x-dev
- symfony/console 2.2.x-dev
Silex fat cousin
Silex is great micro-framework, but it's sometimes just too simple. Fatso is his fat cousin.
It provides very simple, basic classes and automates few things., (*1)
Fatso can:, (*2)
Fatso is ugly., (*3)
TL;DR - goto: demo, (*4)
Config loads files from $app['config.dir']
path.
It also uses env name to merge basic config with it's env variant., (*5)
Config can load PHP, or YML files., (*6)
Example:, (*7)
config/foo.yml:, (*8)
foo: name: bar env: null
config/foo_dev.php:, (*9)
<?php return array( 'foo' => array( 'env' => 'dev', ), );
$config = $app['config']->get('foo'); /* $config = array( 'foo' => array( 'name' => 'bar', 'env' => 'dev', ), ); */
Performs simple environment detection based on host name.
Before running env variable $app['env.host']
must be set., (*10)
$app['env']->get(); // return current env name or NULL if not detected $app['env']->getEnvironments(); // returns list of declared environments.
Environments are defined in config file named env
:, (*11)
dev: /\.local\.com$/ prod: //
Bootstrap is responsible for env detection, Silex providers registration and route registration., (*12)
Routes are defined in config file named routing
:, (*13)
<?php return array( 'main' => array( 'pattern' => '/', 'controller' => 'App:Main:index', // resolves to: \App\Controller\Main::index 'method' => 'get', // can be set to: GET, POST, PUT, DELETE, or MATCH. Default is GET ), );
To register some providers in config dir must be created folder named bootstrap
with providers config files., (*14)
Sample provider config file:, (*15)
\Silex\Provider\TwigServiceProvider: twig.path: 'view/'
There's also sample Fatso skeleton, check it out to see how Fatso works., (*16)
Silex fat cousin
MIT