Download the PHP package alexandresalome/multisite-bundle without Composer
On this page you can find all versions of the php package alexandresalome/multisite-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alexandresalome/multisite-bundle
More information about alexandresalome/multisite-bundle
Files in alexandresalome/multisite-bundle
Package multisite-bundle
Short Description A bundle to manage multiple sites with different brandings and locales
License MIT
Informations about the package multisite-bundle
AlexMultisiteBundle - Branding and Internationalization
This bundle allows you to manage multiple brandings and multiple locales in a Symfony2 application.
- View slides
- CHANGELOG
- CONTRIBUTORS
Requirements:
- FrameworkExtraBundle
- TwigBundle
Features
- Multiple routes for each site
- Configuration per site
- Templates per site
Installation
Add to your composer.json:
Add the bundle to your kernel:
Configuration
Add this section to your config.yml file:
In this section, you must configure your brandings and locales.
You can also add extra options, like the register option here.
Declare your routes
In your controllers, substitute
with
You can then configure a multisite route in two ways:
The path will be the same for all brandings, but will be localized. If you want a different path for same locale in different sites:
Override templates
If you want to change a template for a specific site, create a similarly named file with branding/locale option in it:
Given your default template is AcmeDemoBundle::contact.html.twig
.
You can override it with branding, locale, or both:
AcmeDemoBundle::_branding_locale/contact.html.twig
AcmeDemoBundle::_branding_/contact.html.twig
AcmeDemoBundle::__locale/contact.html.twig
Just create the file and it will automatically be loaded in place of the previous one.
Read the site context
From templates, use the global variable site_context, which returns a Alex\MultisiteBundle\Branding\SiteContext
instance:
You can also read options from config with:
In your controllers, use service site_context:
Disable route sorting
You might want to rely on natural order of routes. If you're in this case, you can disable the optimization by providing the sort_route option:
Security
You can combine this bundle with Symfony's SecurityBundle, and use this bundle for your routes for login form page.
But, you must not use the multisite feature for the following routes:
- login-check
- logout