Propel2 service provider for Silex
Switch branches/tags
Nothing to show
Pull request Compare This branch is 1 commit ahead of kut-io:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Build Status

The Propel2ServiceProvider provides integration with Propel2 and Silex

Be careful: Propel2 is still under heavy development. Please use PropelServiceProvider and Propel1 for production.


  • propel.config_file (optional): The name of Propel configuration file with full path. Default is /full/project/path/generated-conf/config.php

It's strongly recommanded to use absolute paths for previous option.


No service is provided.

Propel configures and manages itself by using static methods and its own service container, so no service is registered into Application. Actually, the Propel2ServiceProvider class initializes Propel in a more "Silex-ian" way.


Both Silex and Propel suggest to manage your projects by using Composer ( Please, read Composer documentation before going ahead.

In your project directory, add the following lines to your composer.json file:

"repositories": [
            "type": "vcs",
            "url": ""
"require": {
    "cristianoc72/propel2-service-provider": ">=0.1"

Then register you model namespace in Composer autoload:

"autoload": {
     "psr-0": { "Your\\Model\\Namespace": "path/of/your/model" }

Then install Composer and all dependencies:


php composer.phar install


After you've installed Propel2ServiceProvider and its dependencies, you can register Propel2ServiceProvider in your application:


$app->register(new Propel\Silex\Propel2ServiceProvider(), array(
    'propel.config_file' => __DIR__.'/path/to/myproject-conf.php'

Alternatively, if you built your model with default Propel generator options:


$app->register(new Propel\Silex\Propel2ServiceProvider());

We can consider "default" Propel generator options:

  • Put schema.xml files into the main directory project
  • Run vendor/bin/propel model:build command without specify any options about directories and namespace package.


You'll have to build the model by yourself. According to Propel documentation, you'll need two files:

  • schema.xml which contains your database schema;

  • runtime-conf.xml which contains the database configuration.

Use the vendor/bin/propel script to create all files (SQL, configuration, Model classes).

vendor/bin/propel model:build
vendor/bin/propel config:convert-xml
vendor/bin/propel sql:build

Propel2 documentation is still in development and you can find it here. schema.xml and runtime-conf.xml reference can be found here:,