PHPackages                             alexandresalome/multisite-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. alexandresalome/multisite-bundle

AbandonedArchivedLibrary

alexandresalome/multisite-bundle
================================

A bundle to manage multiple sites with different brandings and locales

v0.2.0(9y ago)6637.4k↓66.7%20[3 issues](https://github.com/alexandresalome/multisite-bundle/issues)[3 PRs](https://github.com/alexandresalome/multisite-bundle/pulls)MITPHP

Since Apr 12Pushed 8y ago4 watchersCompare

[ Source](https://github.com/alexandresalome/multisite-bundle)[ Packagist](https://packagist.org/packages/alexandresalome/multisite-bundle)[ RSS](/packages/alexandresalome-multisite-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

AlexMultisiteBundle - Branding and Internationalization
=======================================================

[](#alexmultisitebundle---branding-and-internationalization)

[![Build status](https://camo.githubusercontent.com/e6c4c26838f692077c05eae12b1287f2a29c3e4e0ae4ec1ee85fc3df5b661e1e/68747470733a2f2f7472617669732d63692e6f72672f616c6578616e64726573616c6f6d652f6d756c7469736974652d62756e646c652e706e673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/e6c4c26838f692077c05eae12b1287f2a29c3e4e0ae4ec1ee85fc3df5b661e1e/68747470733a2f2f7472617669732d63692e6f72672f616c6578616e64726573616c6f6d652f6d756c7469736974652d62756e646c652e706e673f6272616e63683d6d6173746572) [![Latest Stable Version](https://camo.githubusercontent.com/b76cac07c13565607d42a279eaba791fda840221cd436fcf5e2c40a5eeeb24db/68747470733a2f2f706f7365722e707567782e6f72672f616c6578616e64726573616c6f6d652f6d756c7469736974652d62756e646c652f762f737461626c65)](https://packagist.org/packages/alexandresalome/multisite-bundle) [![Total Downloads](https://camo.githubusercontent.com/15c6c70be97c176c10d4d83698b763f8e8fd97e90824fca23d8978abede05bf1/68747470733a2f2f706f7365722e707567782e6f72672f616c6578616e64726573616c6f6d652f6d756c7469736974652d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/alexandresalome/multisite-bundle) [![License](https://camo.githubusercontent.com/44cc5a2c149afc23cb26a18e69da283da008db29f326dc69dab28ef74f71fa87/68747470733a2f2f706f7365722e707567782e6f72672f616c6578616e64726573616c6f6d652f6d756c7469736974652d62756e646c652f6c6963656e7365)](https://packagist.org/packages/alexandresalome/multisite-bundle) [![Monthly Downloads](https://camo.githubusercontent.com/02184a55ad3d00dd67a074d4cb19b9158079dad8d678fb2cb4fa9c83f1a8b3b2/68747470733a2f2f706f7365722e707567782e6f72672f616c6578616e64726573616c6f6d652f6d756c7469736974652d62756e646c652f642f6d6f6e74686c79)](https://packagist.org/packages/alexandresalome/multisite-bundle) [![Daily Downloads](https://camo.githubusercontent.com/83a6e71d48244198a1a34fb497b5f16ae30d92a948da76d126075f163db74c16/68747470733a2f2f706f7365722e707567782e6f72672f616c6578616e64726573616c6f6d652f6d756c7469736974652d62756e646c652f642f6461696c79)](https://packagist.org/packages/alexandresalome/multisite-bundle)

This bundle allows you to manage multiple brandings and multiple locales in a Symfony2 application.

- [View slides](slides.pdf)
- [CHANGELOG](CHANGELOG.md)
- [CONTRIBUTORS](CONTRIBUTORS.md)

**Requirements**:

- FrameworkExtraBundle
- TwigBundle

Features
--------

[](#features)

- Multiple routes for each site
- Configuration per site
- Templates per site

Installation
------------

[](#installation)

Add to your **composer.json**:

```
{
    "require": {
        "alexandresalome/multisite-bundle": "~0.1"
    }
}
```

Add the bundle to your kernel:

```
# app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            # ...
            new Alex\MultisiteBundle\AlexMultisiteBundle(),
        );
    }
}
```

Configuration
-------------

[](#configuration)

Add this section to your **config.yml** file:

```
alex_multisite:
    default_branding: branding_A
    default_locale:   fr_FR
    brandings:
        _defaults:
            register: true
        branding_A:
            en_GB: { host: branding-a.com }
            fr_FR: { host: branding-a.com, prefix: /fr }
        branding_B:
            _defaults:
                register: false
            en_GB: { host: branding-b.com }
            de_DE: { host: branding-b.de, register: false }
```

In this section, you must configure your brandings and locales.

You can also add extra options, like the **register** option here.

Declare your routes
-------------------

[](#declare-your-routes)

In your controllers, substitute

```
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
```

with

```
use Alex\MultisiteBundle\Annotation\Route;
```

You can then configure a multisite route in two ways:

```
/**
 * @Route(name="login", paths={
 *   "fr_FR"="/connexion",
 *   "en_GB"="/login"
 * })
 */
public function loginAction()
# ...
```

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:

```
/**
 * @Route(name="login", paths={
 *   "branding_A"={
 *     "fr_FR"="/connexion-on-A",
 *     "en_GB"="/login-on-A",
 *   },
 *   "branding_B"={
 *     "en_GB"="/login-on-B",
 *   },
 * })
 */
public function loginAction()
# ...
```

Override templates
------------------

[](#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
---------------------

[](#read-the-site-context)

**From templates**, use the global variable **site\_context**, which returns a `Alex\MultisiteBundle\Branding\SiteContext` instance:

```
You are currently on {{ site_context.currentBrandingName }}
Your locale is {{ site_context.currentLocale }}

```

You can also read options from config with:

```
The option register is {{ site_context.option('register') ? 'enabled': 'not enabled' }}

```

**In your controllers**, use service **site\_context**:

```
public function indexAction()
{
    $this->get('site_context')->getCurrentLocale();
    $this->get('site_context')->getOption('register');
}
```

Disable route sorting
---------------------

[](#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:

```
alex_multisite:
    sort_routes: false
    # ...
```

Security
--------

[](#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

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~409 days

Total

3

Last Release

3600d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c6be58ec4620ddbcc6f95bf7353365dc7ff796c004c70369333aee6125eb309?d=identicon)[alexandresalome](/maintainers/alexandresalome)

---

Top Contributors

[![cedricblondeau](https://avatars.githubusercontent.com/u/1479924?v=4)](https://github.com/cedricblondeau "cedricblondeau (1 commits)")[![h4cc](https://avatars.githubusercontent.com/u/2981491?v=4)](https://github.com/h4cc "h4cc (1 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (1 commits)")[![sanderborgman](https://avatars.githubusercontent.com/u/246604?v=4)](https://github.com/sanderborgman "sanderborgman (1 commits)")

### Embed Badge

![Health badge](/badges/alexandresalome-multisite-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/alexandresalome-multisite-bundle/health.svg)](https://phpackages.com/packages/alexandresalome-multisite-bundle)
```

###  Alternatives

[ed/blog-bundle

Symfony EDBlogBundle

348.4k](/packages/ed-blog-bundle)[ecentria/ecentria-rest-bundle

Goal of this bundle is to simplify process of creating APIs with Symfony. We use already well-coded libraries, combine them together to simplify process and not to re-invent the wheel. We've chose REST and HATEOS to have unified standards of API requests and responses.

142.4k](/packages/ecentria-ecentria-rest-bundle)[symfonyid/admin-bundle

Provide Admin Generator with KISS Principle

141.6k](/packages/symfonyid-admin-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
