2017 © Pedro Peláez
 

library silex-app

Quickly set up Silex applications with a single yaml config file

image

bitolaco/silex-app

Quickly set up Silex applications with a single yaml config file

  • Tuesday, June 23, 2015
  • by bradberger
  • Repository
  • 1 Watchers
  • 3 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

This package provides a quick way to a Silex app and various service providers via a single yaml configuration file, and set up different configurations based on environments., (*2)

It uses Eloquent by default instead of Doctrine, because adding an ORM is an upgrade in our opinion!, (*3)

Documentation forthcoming!, (*4)

Usage

<?php
require_once dirname(__FILE__) . '/vendor/autoload.php';
$app = \BitolaCo\Silex\App::setup("config.yml");
$app->run();
debug: false
eloquent:
    connection:
    connections:
        default:
            driver: mysql
            host: localhost
            database: test
            username: root
            password:
            charset: utf8
            prefix:
            collation: utf8_unicode_ci
            logging:
    cache:
monolog:
    logfile: application.log
    bubble: true
    permission: null
    level: DEBUG|INFO|WARNING|ERROR
    name: MySilexApp
swiftmailer:
    options:
        host: localhost
        port: 25
        username:
        password:
        encryption:
        auth_mode:
translator:
session:
cache:
twig:
routes:
  someName:
    path: /
    defaults:
      _controller: Foo::bar
  _demo:
    path: /demo/{id}
    defaults:
      _controller: Foo::bar
    requirements:
      id: \d+
servers:
  dev:
    - YOUR-MACHINE-NAME
environments:
  dev:
    debug: true
    monolog: development.log

Service Providers

The following service providers are currently supported, with more on the way., (*5)

  • Eloquent
  • Monolog
  • Swiftmailer
  • Translator
  • Session
  • Twig
  • Cache

Monolog

The monolog parameters and what they mean can be found here. It's a one-to-one direct compilation of the parameters there., (*6)

If you're setting the level parameter, be sure you're using a string (like "INFO") instead of the PHP constant like Logger::INFO, since the constant won't work., (*7)

Environments

The main config key servers allows you to set up define environments. The key is the name of the environment, and the value is an array of hostnames that are in that environment., (*8)

When using this option, you can then override default the default configuration by defining variables in the environment[] object., (*9)

For example, if you want debugging on your local machine, who's hostname is dev-machine, you could set things up like this:, (*10)

debug: false
servers:
    dev:
        - dev-machine
environment:
    dev:
        debug: true

In a production setting (i.e. any server without a hostname of dev-machine debugging would be off, but on your local development machine, it would be on., (*11)

Machines can be assigned multiple environments, and the last environment variable overwrites all the previous ones., (*12)

Routing

In the config yaml file, the section for routing is used as follows:, (*13)

routes:
    someName:
        path: /
        defaults:
            _controller: Foo::bar
    _demo:
        path: /demo/{id}
        defaults:
            _controller: Foo::bar
        requirements:
            id: \d+

The Versions

17/06 2015
26/11 2014
26/11 2014

v0.1.2

0.1.2.0

Quickly set up Silex applications with a single yaml config file

  Sources   Download

MPL

The Requires

 

config bootstrap silex yaml

21/11 2014

v0.1.1

0.1.1.0

Quickly set up Silex applications with a single yaml config file

  Sources   Download

MPL

The Requires

 

config bootstrap silex yaml

21/11 2014

v0.1

0.1.0.0

Quickly set up Silex applications with a single yaml config file

  Sources   Download

MPL

The Requires

 

config bootstrap silex yaml