PHPackages                             netgusto/dynamic-subdomain-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. netgusto/dynamic-subdomain-bundle

ActiveSymfony-bundle

netgusto/dynamic-subdomain-bundle
=================================

Symfony2 Dynamic subdomain handler Bundle

151782[1 issues](https://github.com/netgusto/Symfony-DynamicSubdomainBundle/issues)PHP

Since Apr 4Pushed 8y ago1 watchersCompare

[ Source](https://github.com/netgusto/Symfony-DynamicSubdomainBundle)[ Packagist](https://packagist.org/packages/netgusto/dynamic-subdomain-bundle)[ RSS](/packages/netgusto-dynamic-subdomain-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Dynamic subdomain handler for Symfony 2
=======================================

[](#dynamic-subdomain-handler-for-symfony-2)

Install
-------

[](#install)

In `composer.json`:

```
"require": {
    "netgusto/dynamic-subdomain-bundle": "dev-master"
}
```

In `app/AppKernel.php`:

```
$bundles = array(
    # [...]
    new Netgusto\DynamicSubdomainBundle\NetgustoDynamicSubdomainBundle(),
    # [...]
);
```

Configure
---------

[](#configure)

In app/config.yaml

```
netgusto_dynamic_subdomain:
    base_host: netgusto.com
    parameter_name: ~
    entity: Acme\DemoBundle\Entity\MySite
    property: ~
```

- `base_host`:

    - The domain base host, where all subdomains are attached
    - **required**
    - example: `netgusto.com`
- `parameter_name`:

    - The name of the parameter that will be set on the current `Request`
    - **optional**
    - default value: `subdomain`
- `entity`:

    - The class or Doctrine alias of the entity mapped to subdomains
    - **required**
    - example: `Acme\DemoBundle\Entity\MySite`
- `property`:

    - The name of the property storing the subdomain name in your entity
    - **optional**
    - default value: `subdomain`
- `method`:

    - The name of method that will be called to get object with the property defined
    - **optional**
    - default value: `findOneBy`

Use
---

[](#use)

1. Create the entities mapped to your subdomains
2. Get the current subdomain object through the Symfony `Request` object

In php, assuming that `netgusto_dynamic_subdomain.property` equals `subdomain` (the default value):

```
use Symfony\Component\HttpFoundation\Request;

class DefaultController extends Controller {

    public function indexAction(Request $request) {
        $subdomainobject = $request->attributes->get('subdomain');
        var_dump($subdomainobject);
    }
```

In twig, assuming that `netgusto_dynamic_subdomain.property` equals `subdomain` (the default value), and that the entity mapped to subdomains has a `title` property:

```
{{ app.request.attributes.get('subdomain').title }}
```

Notes
-----

[](#notes)

If the subdomain is not found in the database, an exception will be thrown by the Bundle (`Symfony\Component\HttpKernel\Exception\NotFoundHttpException`).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/97d31265ab8dcd891cf8c76a0eb7de6be535c32f80c4d50cc58a3c7f53b1ffe4?d=identicon)[netgusto](/maintainers/netgusto)

---

Top Contributors

[![davidromani](https://avatars.githubusercontent.com/u/698779?v=4)](https://github.com/davidromani "davidromani (2 commits)")[![mrcmorales](https://avatars.githubusercontent.com/u/1423642?v=4)](https://github.com/mrcmorales "mrcmorales (1 commits)")

### Embed Badge

![Health badge](/badges/netgusto-dynamic-subdomain-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/netgusto-dynamic-subdomain-bundle/health.svg)](https://phpackages.com/packages/netgusto-dynamic-subdomain-bundle)
```

PHPackages © 2026

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