saxulum/saxulum-bundle-provider

Saxulum Bundle Provider

Installs: 394

Dependents: 3

Stars: 1

Watchers: 1

Forks: 1

Open Issues: 1

Language: PHP

1.1.1 2015-03-25 15:39 UTC

README

works with plain silex-php

Build Status Total Downloads Latest Stable Version Scrutinizer Code Quality

Features

  • Register commands, controllers, doctrine orm entities, translations, twig templates

Requirements

  • php >=5.3
  • Silex ~1.1

Suggestions

Installation

Through Composer as saxulum/saxulum-bundle-provider.

Console

Use the installation guide of the Saxulum Console.

Controller

Use the installation guide of the Saxulum Route Controller Provider.

Doctrine ORM

AnnotationRegistry

Add this line after you added the autoload.php from composer

\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

Use the installation guide of the Doctrine DBAL Service Provider. Use the installation guide of the Doctrine ORM Service Provider without the mapping settings.

Example
$app->register(new DoctrineOrmServiceProvider(), array(
    'orm.proxies_dir' => __DIR__ . '/../../../../../doctrine/proxies'
));

Translation

Use the installation guide of the Saxulum Translation Provider.

Twig

Use the installation guide of the Twig Provider.

Bundle

Create a provider which extends Saxulum\BundleProvider\Provider\AbstractBundleProvider and register it.

Example Provider
<?php

namespace Saxulum\Tests\BundleProvider\Sample;

use Saxulum\BundleProvider\Provider\AbstractBundleProvider;
use Silex\Application;

class BundleProvider extends AbstractBundleProvider
{
    public function register(Application $app)
    {
        $this->addCommands($app);
        $this->addControllers($app);
        $this->addDoctrineOrmMappings($app);
        $this->addTranslatorRessources($app);
        $this->addTwigLoaderFilesystemPath($app);
    }

    public function boot(Application $app) {}
}
$app->register(new BundleProvider());

Usage

Console

Add commands to the Command folder relative to your BundleProvider extending the Saxulum\Console\Command\AbstractCommand.

Controller

Add controllers to the Controller folder relative to your BundleProvider.

Doctrine ORM

Add entities to the Entity folder relative to your BundleProvider.

Translation

Add translations to the Resources/translations folder relative to your BundleProvider. For example a file called messages.en.yml

Twig

Add templates to the Resources/views folder relative to your BundleProvider. For example a file called test.html.twig. You can render it with

$app['twig']->render('@SaxulumTestsBundleProviderSample/test.html.twig')