2017 © Pedro Peláez
 

library saxulum-bundle-provider

Saxulum Bundle Provider

image

saxulum/saxulum-bundle-provider

Saxulum Bundle Provider

  • Friday, April 20, 2018
  • by dominikzogg
  • Repository
  • 1 Watchers
  • 1 Stars
  • 947 Installations
  • PHP
  • 2 Dependents
  • 1 Suggesters
  • 2 Forks
  • 1 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

saxulum-bundle-provider

works with plain silex-php, (*1)

Build Status Total Downloads Latest Stable Version Scrutinizer Code Quality, (*2)

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., (*3)

Console

Use the installation guide of the Saxulum Console., (*4)

Controller

Use the installation guide of the Saxulum Route Controller Provider., (*5)

Doctrine ORM

AnnotationRegistry

Add this line after you added the autoload.php from composer, (*6)

```{.php} \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));, (*7)


Use the installation guide of the [Doctrine DBAL Service Provider][6]. Use the installation guide of the [Doctrine ORM Service Provider][1] without the mapping settings. #### Example ``` {.php} $app->register(new DoctrineOrmServiceProvider(), array( 'orm.proxies_dir' => __DIR__ . '/../../../../../doctrine/proxies' ));

Translation

Use the installation guide of the Saxulum Translation Provider., (*8)

Twig

Use the installation guide of the [Twig Provider][7]., (*9)

Bundle

Create a provider which extends Saxulum\BundleProvider\Provider\AbstractBundleProvider and register it., (*10)

Example Provider

``` {.php} <?php, (*11)

namespace Saxulum\Tests\BundleProvider\Sample;, (*12)

use Saxulum\BundleProvider\Provider\AbstractBundleProvider; use Silex\Application;, (*13)

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

public function boot(Application $app) {}

}, (*15)


``` {.php} $app->register(new BundleProvider());

Usage

Console

Add commands to the Command folder relative to your BundleProvider extending the Saxulum\Console\Command\AbstractCommand., (*16)

Controller

Add controllers to the Controller folder relative to your BundleProvider., (*17)

Doctrine ORM

Add entities to the Entity folder relative to your BundleProvider., (*18)

Translation

Add translations to the Resources/translations folder relative to your BundleProvider. For example a file called messages.en.yml, (*19)

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, (*20)

{.php} $app['twig']->render('@SaxulumTestsBundleProviderSample/test.html.twig'), (*21)

The Versions