saxulum / saxulum-bundle-provider
Saxulum Bundle Provider
Installs: 1 071
Dependents: 2
Suggesters: 1
Security: 0
Stars: 1
Watchers: 0
Forks: 2
Open Issues: 1
Requires
- php: >=5.3.3
- silex/silex: ~1.1
Requires (Dev)
- dflydev/doctrine-orm-service-provider: ~1.0,>=1.0.4
- phpunit/phpunit: 3.7.*
- saxulum/saxulum-console: ~2.0
- saxulum/saxulum-route-controller-provider: ~1.2,>=1.2.3
- saxulum/saxulum-translation-provider: ~1.0,>=1.0.3
- symfony/browser-kit: ~2.3
- twig/twig: >=1.8,<2.0-dev
This package is not auto-updated.
Last update: 2020-09-22 19:11:00 UTC
README
works with plain silex-php
Features
- Register commands, controllers, doctrine orm entities, translations, twig templates
Requirements
- php >=5.3
- Silex ~1.1
Suggestions
- Doctrine ORM Service Provider >= 1.0.4
- Saxulum Console >= 1.2.0
- Saxulum Route Controller Provider >= 1.0.3
- Saxulum Translation Provider >= 1.0.0
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')