2017 © Pedro Peláez
 

library subdomainmap

Middleware to map the kernels depending on the subdomain

image

alejandroherr/subdomainmap

Middleware to map the kernels depending on the subdomain

  • Monday, June 9, 2014
  • by AlejandroHerr
  • Repository
  • 1 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

SubdomainMap

Build Status, (*1)

Middleware to map the kernels depending on the subdomain., (*2)

Heavily inspired in URL Map Stack Middleware., (*3)

HOW TO

Installation

Via composer.json:, (*4)

{
    "require": {
        "alejandroherr/subdomainmap": "dev-master"
    }
}

Example using Silex Application

<?php
$loader = require ROOT . "/vendor/autoload.php";

use Silex\Application;
use Symfony\Component\HttpFoundation\Request;

$app=new Application();
$app->get('/', function () use ($app) {
    return 'Main app';
});

$appA=new Application();
$appA->get('/', function () use ($appA) {
    return 'appA';
});
$appB=new Application();
$appB->get('/', function () use ($appB) {
    return 'appB';
});

$map = array(
    'appa' => $appA,
    'appb' => $appB
);

$app = new AlejandroHerr\Stack\SubdomainMap($app,$map);

$request = Request::createFromGlobals();
$response = $app->handle($request);
$response->send();

Recommendations

When working with large apps/HttpKernelsInterfaces, try the LazyHttpKernel, (*5)

Example

<?php
$loader = require ROOT . "/vendor/autoload.php";

use Silex\Application;
use Stack\lazy;
use Symfony\Component\HttpFoundation\Request;

$app=new Application();
$app->get('/', function () use ($app) {
    return 'Nothing here';
});

$appA=new Application();
$appA->get('/', function () use ($appA) {
    return 'I am appA';
});
$appA = lazy(function () use ($appA) {
    return $appA;
});

$app = new AlejandroHerr\Stack\SubdomainMap(
    $app,
    array('appa' => $appA)
);

$request = Request::createFromGlobals();
$response = $app->handle($request);
$response->send();

The Versions

09/06 2014

dev-develop

dev-develop

Middleware to map the kernels depending on the subdomain

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar AlejandroHerr

stack subdomain

09/06 2014

dev-master

9999999-dev

Middleware to map the kernels depending on the subdomain

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar AlejandroHerr

stack subdomain

09/06 2014

v1.0

1.0.0.0

Middleware to map the kernels depending on the subdomain

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar AlejandroHerr

stack subdomain