PHPackages                             prodigious/symfony-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. [Framework](/categories/framework)
4. /
5. prodigious/symfony-multisite-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

prodigious/symfony-multisite-bundle
===================================

This bundle allows you to manage multisite in symfony application.

1.0.8(7y ago)5498↓100%MITPHPPHP &gt;=7.1.0

Since May 18Pushed 7y agoCompare

[ Source](https://github.com/nan-guo/Symfony-Multisite-Bundle)[ Packagist](https://packagist.org/packages/prodigious/symfony-multisite-bundle)[ Docs](https://github.com/nan-guo/Symfony-Multisite-Bundle.git)[ RSS](/packages/prodigious-symfony-multisite-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (8)Dependencies (2)Versions (9)Used By (0)

Symfony Multisite Bundle
========================

[](#symfony-multisite-bundle)

The repository contains the Symfony multisite bundle for Symfony 3. This bundle allows you to manage multisite in symfony application.

- Each site can have its own database connection or use the same database.
- Each site can have diffirent locales
- Each site can have its own app folder and public folder
- Each site can have its own robots.txt

Structure public folder
-----------------------

[](#structure-public-folder)

Each sites first looks for assets in its own folder

For example (demo\_2):

The site demo\_2 will first look for the image chat.png in

/web/public/demo\_2/imgs/chat.png

if this image does not exist, the file /web/imgs/chat.png will be used

Structure robots.txt
--------------------

[](#structure-robotstxt)

Each site can have its own robots.txt in the folder :

/robots/hostname.txt

if hostname.txt does not exist, the file /web/robots.txt will be used.

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

[](#installation)

```

composer require prodigious/symfony-multisite-bundle

```

Setup
-----

[](#setup)

```
    $bundles = array(
        ...
        new Prodigious\MultisiteBundle\MultisiteBundle(),
        ...
    );
```

Then add these lines to your composer.json of your Symfony project:

```
    "scripts": {
        "post-install-cmd": [
            ...
            "Prodigious\\MultisiteBundle\\Composer\\ScriptHandler::installBundle"
        ],
        "post-update-cmd": [
            ...
            "Prodigious\\MultisiteBundle\\Composer\\ScriptHandler::installBundle"
        ]
    }

```

Afterwards, initialize the bundle using

```

composer install

```

After the installation, the bundle will create some files in your project :

- sites/
- app/MultisiteKernel.php

And you need to modify some files :

##### Add these lines to .htaccess in the folder web:

[](#add-these-lines-to-htaccess-in-the-folder-web)

```

    RewriteEngine On

    # Multisite conditions
    RewriteCond %{DOCUMENT_ROOT}/robots/%{HTTP_HOST}.txt -f
    RewriteRule ^robots\.txt$ robots/%{HTTP_HOST}.txt [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^public/([^/]+)(?:/(.*)|$) /$2 [QSA,R,L]
    # End

```

##### Modifiy your app.php and app\_dev.php in the folder web:

[](#modifiy-your-appphp-and-app_devphp-in-the-folder-web)

Replace

```
require __DIR__.'/../vendor/autoload.php

```

To

```
require __DIR__.'/../sites/autoload/sites.php';

```

And Relace

```
    // app.php
    $kernel = new AppKernel('prod', false);
    // app_dev.php
    $kernel = new AppKernel('dev', true);

```

To

```
    // app.php
    $kernel = new MultisiteKernel('prod', false);
    $kernel->setSite($site);
    // app_dev.php
    $kernel = new MultisiteKernel('dev', true);
    $kernel->setSite($site);

```

Like this :

```
// require __DIR__.'/../vendor/autoload.php';
require __DIR__.'/../sites/autoload/sites.php';

if (PHP_VERSION_ID < 70000) {
    include_once __DIR__.'/../var/bootstrap.php.cache';
}

$kernel = new MultisiteKernel('prod', false);
$kernel->setSite($site);
if (PHP_VERSION_ID < 70000) {
    $kernel->loadClassCache();
}
```

Instructions
------------

[](#instructions)

There is a list of commands to manage your sites.

#### Create a new site

[](#create-a-new-site)

```

php bin/console site:create

```

[![screenshot](https://github.com/nan-guo/Symfony-Multisite-Bundle/raw/master/Resources/public/imgs/screenshot-1.png)](https://github.com/nan-guo/Symfony-Multisite-Bundle/blob/master/Resources/public/imgs/screenshot-1.png)

#### Get the list of sites

[](#get-the-list-of-sites)

```

php bin/console site:list

```

[![screenshot](https://github.com/nan-guo/Symfony-Multisite-Bundle/raw/master/Resources/public/imgs/screenshot-2.png)](https://github.com/nan-guo/Symfony-Multisite-Bundle/blob/master/Resources/public/imgs/screenshot-2.png)

#### Disable a site

[](#disable-a-site)

```

php bin/console site:disable --name=demo_1

```

[![screenshot](https://github.com/nan-guo/Symfony-Multisite-Bundle/raw/master/Resources/public/imgs/screenshot-3.png)](https://github.com/nan-guo/Symfony-Multisite-Bundle/blob/master/Resources/public/imgs/screenshot-3.png)

#### Enable a site

[](#enable-a-site)

```

php bin/console site:enable --name=demo_1

```

[![screenshot](https://github.com/nan-guo/Symfony-Multisite-Bundle/raw/master/Resources/public/imgs/screenshot-4.png)](https://github.com/nan-guo/Symfony-Multisite-Bundle/blob/master/Resources/public/imgs/screenshot-4.png)

#### Delete a site

[](#delete-a-site)

```

php bin/console site:delete --name=demo_1

```

[![screenshot](https://github.com/nan-guo/Symfony-Multisite-Bundle/raw/master/Resources/public/imgs/screenshot-5.png)](https://github.com/nan-guo/Symfony-Multisite-Bundle/blob/master/Resources/public/imgs/screenshot-5.png)

#### Synchronizer configuration

[](#synchronizer-configuration)

```

php bin/console site:config:sync

```

Attributes
----------

[](#attributes)

```

$currentSite = $request->attributes->get('site'); // 'app' by default

```

```

$currentInstance = $request->attributes->get('instance');

```

```

$currentLocal = $request->getLocale();

```

Additional info
---------------

[](#additional-info)

Author: [Nan GUO](https://github.com/nan-guo/)

Company : [Prodigious](http://www.prodigious.com/)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~20 days

Recently: every ~6 days

Total

8

Last Release

2774d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ad5c92c69a118800ec88598e651cef562f2d4b263c56200ce586e6f61f4f0f41?d=identicon)[nan-guo](/maintainers/nan-guo)

---

Top Contributors

[![nan-guo](https://avatars.githubusercontent.com/u/30159577?v=4)](https://github.com/nan-guo "nan-guo (1 commits)")

---

Tags

muitlsitemulti-sitemultisitebundlesymfonysymfony multisitesymfony multi-sitesmultisite bundlemulti-sites bundle

### Embed Badge

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

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

PHPackages © 2026

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