Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Subdomain routing bundle for Symfony2.

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Readme.md

How to install

Add the following lines to your deps file:

[ITZRouterBundle]    
    git=http://github.com/imikay/RouterBundle.git
    target=/bundles/ITZ/RouterBundle

Run the command:

php bin/vendors install

Add the following two lines to your parameters.ini(in app/config folder)

router.options.generator_base_class = ITZ\RouterBundle\Component\Routing\Generator\UrlGenerator
router.options.matcher_dumper_class = ITZ\RouterBundle\Component\Routing\Matcher\Dumper\PhpMatcherDumper

Add the following line to the autoload.php file

'ITZ'                 => __DIR__.'/../vendor/bundles'

Add one method - getParent to you bundle to make your bundle inherit from Symfony FrameworkBundle, for example

<?php
    # src/Acme/DemoBundle/AcmeDemoBundle.php

    namespace Acme\DemoBundle;

    use Symfony\Component\HttpKernel\Bundle\Bundle;

    class AcmeDemoBundle extends Bundle
    {
        public function getParent()
        {
          return 'FrameworkBundle';
        }
    }

You are done.

Quick example

_some_route:
    pattern:   /something/{slug}
    defaults: { _controller: AcmeDemoBundle:Something:something }
    requirements:
      _host: http://{subdomain}.example.com
      subdomain: /^option1|option2$/
      _scheme: http

or

/**
 * @Route("/something/something", name="_some_route",  requirements = {"_host" = "subdomain.example.com" })
 * @Template()
 */
public function somethingAction()
{
    return array();
}
Something went wrong with that request. Please try again.