Browse Source

Merge pull request #1543 from TechEmpower/php-lumen

Php lumen
Mike Smith 10 years ago
parent
commit
4c2210e470

+ 1 - 0
.travis.yml

@@ -114,6 +114,7 @@ env:
     - "TESTDIR=PHP/php-laravel"
     - "TESTDIR=PHP/limonade"
     - "TESTDIR=PHP/lithium"
+    - "TESTDIR=PHP/lumen"
     - "TESTDIR=PHP/php-micromvc"
     - "TESTDIR=PHP/php-phalcon"
     - "TESTDIR=PHP/php-phalcon-micro"

+ 5 - 0
frameworks/PHP/lumen/.env

@@ -0,0 +1,5 @@
+DB_CONNECTION=mysql
+DB_HOST=localhost
+DB_DATABASE=hello_world
+DB_USERNAME=benchmarkdbuser
+DB_PASSWORD=benchmarkdbpass

+ 3 - 0
frameworks/PHP/lumen/.gitignore

@@ -0,0 +1,3 @@
+vendor
+storage
+deploy/php-fpm.pid

+ 11 - 0
frameworks/PHP/lumen/app/Http/Models/Fortune.php

@@ -0,0 +1,11 @@
+<?php
+
+use Illuminate\Database\Eloquent\Model;
+
+class Fortune extends Model {
+
+	protected $table = "Fortune";
+	public $timestamps = false;
+}
+
+?>

+ 10 - 0
frameworks/PHP/lumen/app/Http/Models/World.php

@@ -0,0 +1,10 @@
+<?php
+use Illuminate\Database\Eloquent\Model;
+
+class World extends Model {
+
+	protected $table = "World";
+	public $timestamps = false;
+}
+
+?>

+ 72 - 0
frameworks/PHP/lumen/app/Http/routes.php

@@ -0,0 +1,72 @@
+<?php
+
+use Illuminate\Http\Request;
+
+require_once __DIR__.'/Models/World.php';
+require_once __DIR__.'/Models/Fortune.php';
+
+$app->get("plaintext", function() {
+    return response("Hello, World!")->header("Content-Type", "text/plain");
+});
+
+$app->get("json", function() {
+	return response()->json(["message" => "Hello, World!"]);
+});
+
+$app->get("db", function() {
+	$id = mt_rand(1, 10000);
+	$result = World::find($id);
+	return response()->json($result);
+});
+
+$app->get("queries", function(Request $request) {
+	$query_count = $request->input("queries");
+	if ($query_count < 1) {
+		$query_count = 1;
+	}
+	if ($query_count > 500) {
+		$query_count = 500;
+	}
+
+	$worlds = array();
+
+	for ($i = 0; $i < $query_count; $i++) {
+		$id = mt_rand(1, 10000);
+		$world = World::find($id);
+		$worlds[] = $world;
+	}
+
+	return response()->json($worlds);
+});
+
+$app->get("updates", function(Request $request) {
+	$query_count = $request->input("queries");
+	if ($query_count < 1) {
+		$query_count = 1;
+	}
+	if ($query_count > 500) {
+		$query_count = 500;
+	}
+
+	$worlds = array();
+
+	for ($i = 0; $i < $query_count; $i++) {
+		$id = mt_rand(1, 10000);
+		$world = World::find($id);
+		$world->randomNumber = mt_rand(1, 10000);
+		$world->save();
+		$worlds[] = $world;
+	}
+
+	return response()->json($worlds);
+});
+
+$app->get("fortune", function() use ($app) {
+	$fortunes = Fortune::all()->toArray();
+	$new_fortune = array("id" => 0, "message" => "Additional fortune added at request time.");
+	$fortunes[] = $new_fortune;
+	$fortunes = array_sort($fortunes, function($value) {
+		return $value["message"];
+	});
+	return view("fortune", ["fortunes" => $fortunes]);
+});

+ 27 - 0
frameworks/PHP/lumen/benchmark_config.json

@@ -0,0 +1,27 @@
+
+{
+  "framework": "lumen",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/json",
+      "plaintext_url": "/plaintext",
+      "db_url": "/db",
+      "query_url": "/queries?queries=",
+      "fortune_url": "/fortune",
+      "update_url": "/updates?queries=",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Micro",
+      "database": "MySQL",
+      "framework": "Lumen",
+      "language": "PHP",
+      "orm": "Full",
+      "platform": "PHP-FPM",
+      "webserver": "nginx",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "Lumen"
+    }
+  }]
+}

+ 13 - 0
frameworks/PHP/lumen/bootstrap/app.php

@@ -0,0 +1,13 @@
+<?php
+require_once __DIR__.'/../vendor/autoload.php';
+
+Dotenv::load(__DIR__.'/../');
+
+$app = new Laravel\Lumen\Application;
+$app->withFacades();
+$app->withEloquent();
+
+require __DIR__.'/../app/Http/routes.php';
+
+return $app;
+

+ 6 - 0
frameworks/PHP/lumen/composer.json

@@ -0,0 +1,6 @@
+{
+   "require": {
+   	"laravel/lumen" : "5.0.1"
+   }
+}
+

+ 9 - 0
frameworks/PHP/lumen/deploy/lumen

@@ -0,0 +1,9 @@
+<VirtualHost *:8080>
+  Alias /lumen/ "/home/ubuntu/FrameworkBenchmarks/lumen/public/"
+  <Directory /home/ubuntu/FrameworkBenchmarks/lumen/public/>
+          Options Indexes FollowSymLinks MultiViews
+          #AllowOverride None
+          Order allow,deny
+          allow from all
+  </Directory>
+</VirtualHost>

+ 41 - 0
frameworks/PHP/lumen/deploy/nginx.conf

@@ -0,0 +1,41 @@
+worker_processes  8;
+
+error_log stderr error;
+
+events {
+    worker_connections  1024;
+}
+
+http {
+    include /usr/local/nginx/conf/mime.types;    
+    default_type  application/octet-stream;
+    access_log off;
+    sendfile        on;
+    keepalive_timeout  65;
+
+    upstream fastcgi_backend {
+        server 127.0.0.1:9001;
+        keepalive 32;
+    }
+    server {
+        listen       8080;
+        server_name  localhost;
+
+        root /home/ubuntu/FrameworkBenchmarks/lumen/;
+        index  index.php;
+
+        location / {
+           try_files $uri $uri/ /index.php?$query_string;
+        }
+
+        location ~ \.php$ {
+            try_files $uri =404;
+            fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
+            fastcgi_index  index.php;
+            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
+            include        /usr/local/nginx/conf/fastcgi_params;
+        }
+
+    }
+}

+ 6 - 0
frameworks/PHP/lumen/index.php

@@ -0,0 +1,6 @@
+<?php
+
+$app = require __DIR__.'/bootstrap/app.php';
+
+$app->run();
+

+ 10 - 0
frameworks/PHP/lumen/install.sh

@@ -0,0 +1,10 @@
+export PHP_HOME=${IROOT}/php-5.5.17
+export COMPOSER_HOME=${IROOT}/php-composer
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+export NGINX_HOME=${IROOT}/nginx
+
+fw_depends php nginx composer
+
+${PHP_HOME}/bin/php ${COMPOSER_HOME}/composer.phar install \
+  --no-interaction --working-dir $TROOT \
+  --no-progress --optimize-autoloader 

+ 1655 - 0
frameworks/PHP/lumen/modifiedVendorFiles/Application.php

@@ -0,0 +1,1655 @@
+<?php namespace Laravel\Lumen;
+
+use Closure;
+use Exception;
+use ErrorException;
+use Monolog\Logger;
+use FastRoute\Dispatcher;
+use Illuminate\Http\Request;
+use Illuminate\Http\Response;
+use Illuminate\Pipeline\Pipeline;
+use Monolog\Handler\StreamHandler;
+use Illuminate\Container\Container;
+use Illuminate\Foundation\Composer;
+use Monolog\Formatter\LineFormatter;
+use Illuminate\Filesystem\Filesystem;
+use Illuminate\Support\Facades\Facade;
+use Illuminate\Support\ServiceProvider;
+use Symfony\Component\Console\Output\ConsoleOutput;
+use Illuminate\Http\Exception\HttpResponseException;
+use Illuminate\Config\Repository as ConfigRepository;
+use Symfony\Component\HttpKernel\HttpKernelInterface;
+use Illuminate\Contracts\Routing\TerminableMiddleware;
+use Symfony\Component\HttpFoundation\BinaryFileResponse;
+use Symfony\Component\HttpKernel\Exception\HttpException;
+use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
+use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+use Illuminate\Contracts\Foundation\Application as ApplicationContract;
+use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
+
+class Application extends Container implements ApplicationContract, HttpKernelInterface
+{
+
+    /**
+     * Indicates if the class aliases have been registered.
+     *
+     * @var bool
+     */
+    protected static $aliasesRegistered = false;
+
+    /**
+     * The base path of the application installation.
+     *
+     * @var string
+     */
+    protected $basePath;
+
+    /**
+     * The storage path of the application installation.
+     *
+     * @var string
+     */
+    protected $storagePath;
+
+    /**
+     * The configuration path of the application installation.
+     *
+     * @var string
+     */
+    protected $configPath;
+
+    /**
+     * The resource path of the application installation.
+     *
+     * @var string
+     */
+    protected $resourcePath;
+
+    /**
+     * All of the loaded configuration files.
+     *
+     * @var array
+     */
+    protected $loadedConfigurations = [];
+
+    /**
+     * All of the routes waiting to be registered.
+     *
+     * @var array
+     */
+    protected $routes = [];
+
+    /**
+     * All of the named routes and URI pairs.
+     *
+     * @var array
+     */
+    public $namedRoutes = [];
+
+    /**
+     * The shared attributes for the current route group.
+     *
+     * @var array|null
+     */
+    protected $groupAttributes;
+
+    /**
+     * All of the global middleware for the application.
+     *
+     * @var array
+     */
+    protected $middleware = [];
+
+    /**
+     * All of the route specific middleware short-hands.
+     *
+     * @var array
+     */
+    protected $routeMiddleware = [];
+
+    /**
+     * The current route being dispatched.
+     *
+     * @var array
+     */
+    protected $currentRoute;
+
+    /**
+     * The loaded service providers.
+     *
+     * @var array
+     */
+    protected $loadedProviders = [];
+
+    /**
+     * The service binding methods that have been executed.
+     *
+     * @var array
+     */
+    protected $ranServiceBinders = [];
+
+    /**
+     * The FastRoute dispatcher.
+     *
+     * @var \FastRoute\Dispatcher
+     */
+    protected $dispatcher;
+
+    /**
+     * Create a new Lumen application instance.
+     *
+     * @param  string|null  $basePath
+     * @return void
+     */
+    public function __construct($basePath = null)
+    {
+        date_default_timezone_set(env('APP_TIMEZONE', 'UTC'));
+
+        $this->basePath = $basePath;
+        $this->bootstrapContainer();
+        $this->registerErrorHandling();
+    }
+
+    /**
+     * Bootstrap the application container.
+     *
+     * @return void
+     */
+    protected function bootstrapContainer()
+    {
+        static::setInstance($this);
+
+        $this->instance('app', $this);
+
+        $this->registerContainerAliases();
+    }
+
+    /**
+     * Get the version number of the application.
+     *
+     * @return string
+     */
+    public function version()
+    {
+        return 'Lumen (5.0.10) (Laravel Components 5.0.*)';
+    }
+
+    /**
+     * Get or check the current application environment.
+     *
+     * @param  mixed
+     * @return string
+     */
+    public function environment()
+    {
+        return env('APP_ENV', 'production');
+    }
+
+    /**
+     * Determine if the application is currently down for maintenance.
+     *
+     * @return bool
+     */
+    public function isDownForMaintenance()
+    {
+        return false;
+    }
+
+    /**
+     * Register all of the configured providers.
+     *
+     * @return void
+     */
+    public function registerConfiguredProviders()
+    {
+        //
+    }
+
+    /**
+     * Register a service provider with the application.
+     *
+     * @param  \Illuminate\Support\ServiceProvider|string  $provider
+     * @param  array  $options
+     * @param  bool   $force
+     * @return \Illuminate\Support\ServiceProvider
+     */
+    public function register($provider, $options = array(), $force = false)
+    {
+        if (!$provider instanceof ServiceProvider) {
+            $provider = new $provider($this);
+        }
+
+        if (array_key_exists($providerName = get_class($provider), $this->loadedProviders)) {
+            return;
+        }
+
+        $this->loadedProviders[$providerName] = true;
+
+        $provider->register();
+        $provider->boot();
+    }
+
+    /**
+     * Register a deferred provider and service.
+     *
+     * @param  string  $provider
+     * @param  string  $service
+     * @return void
+     */
+    public function registerDeferredProvider($provider, $service = null)
+    {
+        return $this->register($provider);
+    }
+
+    /**
+     * Boot the application's service providers.
+     *
+     * @return void
+     */
+    public function boot()
+    {
+        //
+    }
+
+    /**
+     * Register a new boot listener.
+     *
+     * @param  mixed  $callback
+     * @return void
+     */
+    public function booting($callback)
+    {
+        //
+    }
+
+    /**
+     * Register a new "booted" listener.
+     *
+     * @param  mixed  $callback
+     * @return void
+     */
+    public function booted($callback)
+    {
+        //
+    }
+
+    /**
+     * Set the error handling for the application.
+     *
+     * @return void
+     */
+    protected function registerErrorHandling()
+    {
+        error_reporting(-1);
+
+        set_error_handler(function ($level, $message, $file = '', $line = 0) {
+            if (error_reporting() & $level) {
+                throw new ErrorException($message, 0, $level, $file, $line);
+            }
+        });
+
+        set_exception_handler(function ($e) {
+            $this->handleUncaughtException($e);
+        });
+    }
+
+    /**
+     * Send the exception to the handler and retunr the response.
+     *
+     * @param  Exception  $e
+     * @return Response
+     */
+    protected function sendExceptionToHandler($e)
+    {
+        $handler = $this->make('Illuminate\Contracts\Debug\ExceptionHandler');
+
+        $handler->report($e);
+
+        return $handler->render($this->make('request'), $e);
+    }
+
+    /**
+     * Handle an uncaught exception instance.
+     *
+     * @param  Exception  $e
+     * @return void
+     */
+    protected function handleUncaughtException($e)
+    {
+        $handler = $this->make('Illuminate\Contracts\Debug\ExceptionHandler');
+
+        $handler->report($e);
+
+        if ($this->runningInConsole()) {
+            $handler->renderForConsole(new ConsoleOutput, $e);
+        } else {
+            $handler->render($this->make('request'), $e)->send();
+        }
+    }
+
+    /**
+     * Throw an HttpException with the given data.
+     *
+     * @param  int     $code
+     * @param  string  $message
+     * @param  array   $headers
+     * @return void
+     *
+     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
+     */
+    public function abort($code, $message = '', array $headers = array())
+    {
+        if ($code == 404) {
+            throw new NotFoundHttpException($message);
+        }
+
+        throw new HttpException($code, $message, null, $headers);
+    }
+
+    /**
+     * Resolve the given type from the container.
+     *
+     * @param  string  $abstract
+     * @param  array   $parameters
+     * @return mixed
+     */
+    public function make($abstract, $parameters = [])
+    {
+        if (array_key_exists($abstract, $this->availableBindings) &&
+            ! array_key_exists($this->availableBindings[$abstract], $this->ranServiceBinders)) {
+            $this->{$method = $this->availableBindings[$abstract]}();
+
+            $this->ranServiceBinders[$method] = true;
+        }
+
+        return parent::make($abstract, $parameters);
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerAuthBindings()
+    {
+        $this->singleton('auth', function () {
+            return $this->loadComponent('auth', 'Illuminate\Auth\AuthServiceProvider', 'auth');
+        });
+
+        $this->singleton('auth.driver', function () {
+            return $this->loadComponent('auth', 'Illuminate\Auth\AuthServiceProvider', 'auth.driver');
+        });
+
+        $this->singleton('auth.password', function () {
+            return $this->loadComponent('auth', 'Illuminate\Auth\Passwords\PasswordResetServiceProvider', 'auth.password');
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerBusBindings()
+    {
+        $this->singleton('Illuminate\Contracts\Bus\Dispatcher', function () {
+            $this->register('Illuminate\Bus\BusServiceProvider');
+
+            return $this->make('Illuminate\Contracts\Bus\Dispatcher');
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerCacheBindings()
+    {
+        $this->singleton('cache', function () {
+            return $this->loadComponent('cache', 'Illuminate\Cache\CacheServiceProvider');
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerConfigBindings()
+    {
+        $this->singleton('config', function () {
+            return new ConfigRepository;
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerComposerBindings()
+    {
+        $this->app->singleton('composer', function ($app) {
+            return new Composer($app->make('files'), $this->basePath());
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerCookieBindings()
+    {
+        $this->singleton('cookie', function () {
+            return $this->loadComponent('session', 'Illuminate\Cookie\CookieServiceProvider', 'cookie');
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerDatabaseBindings()
+    {
+        $this->singleton('db', function () {
+            return $this->loadComponent(
+                'database', [
+                    'Illuminate\Database\DatabaseServiceProvider',
+                    'Illuminate\Pagination\PaginationServiceProvider'],
+                'db'
+            );
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerEncrypterBindings()
+    {
+        $this->singleton('encrypter', function () {
+            return $this->loadComponent('app', 'Illuminate\Encryption\EncryptionServiceProvider', 'encrypter');
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerEventBindings()
+    {
+        $this->singleton('events', function () {
+            $this->register('Illuminate\Events\EventServiceProvider');
+
+            return $this->make('events');
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerErrorBindings()
+    {
+        if (! $this->bound('Illuminate\Contracts\Debug\ExceptionHandler')) {
+            $this->singleton(
+                'Illuminate\Contracts\Debug\ExceptionHandler', 'Laravel\Lumen\Exceptions\Handler'
+            );
+        }
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerFilesBindings()
+    {
+        $this->singleton('files', function () {
+            return new Filesystem;
+        });
+
+        $this->singleton('filesystem', function () {
+            return $this->loadComponent('filesystems', 'Illuminate\Filesystem\FilesystemServiceProvider', 'filesystem');
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerHashBindings()
+    {
+        $this->singleton('hash', function () {
+            $this->register('Illuminate\Hashing\HashServiceProvider');
+
+            return $this->make('hash');
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerLogBindings()
+    {
+        $this->singleton('Psr\Log\LoggerInterface', function () {
+            return new Logger('lumen', [$this->getMonologHandler()]);
+        });
+    }
+
+    /**
+     * Get the Monolog handler for the application.
+     *
+     * @return \Monolog\Handler\AbstractHandler
+     */
+    protected function getMonologHandler()
+    {
+        return (new StreamHandler(getcwd().'/vendor/laravel/lumen-framework/storage/logs/lumen.log', Logger::DEBUG))
+                            ->setFormatter(new LineFormatter(null, null, true, true));
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerMailBindings()
+    {
+        $this->singleton('mailer', function () {
+            $this->configure('services');
+
+            return $this->loadComponent('mail', 'Illuminate\Mail\MailServiceProvider', 'mailer');
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerQueueBindings()
+    {
+        $this->singleton('queue', function () {
+            return $this->loadComponent('queue', 'Illuminate\Queue\QueueServiceProvider', 'queue');
+        });
+
+        $this->singleton('queue.connection', function () {
+            return $this->loadComponent('queue', 'Illuminate\Queue\QueueServiceProvider', 'queue.connection');
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerRedisBindings()
+    {
+        $this->singleton('redis', function() {
+            return $this->loadComponent('database', 'Illuminate\Redis\RedisServiceProvider', 'redis');
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerRequestBindings()
+    {
+        $this->singleton('Illuminate\Http\Request', function () {
+            return Request::capture()->setUserResolver(function () {
+                return $this->make('auth')->user();
+            })->setRouteResolver(function () {
+                return $this->currentRoute;
+            });
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerSessionBindings()
+    {
+        $this->singleton('session', function () {
+            return $this->loadComponent('session', 'Illuminate\Session\SessionServiceProvider');
+        });
+
+        $this->singleton('session.store', function () {
+            return $this->loadComponent('session', 'Illuminate\Session\SessionServiceProvider', 'session.store');
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerTranslationBindings()
+    {
+        $this->singleton('translator', function () {
+            $this->configure('app');
+
+            $this->instance('path.lang', $this->getLanguagePath());
+
+            $this->register('Illuminate\Translation\TranslationServiceProvider');
+
+            return $this->make('translator');
+        });
+    }
+
+    /**
+     * Get the path to the application's language files.
+     *
+     * @return string
+     */
+    protected function getLanguagePath()
+    {
+        if (is_dir($appPath = $this->resourcePath('lang'))) {
+            return $appPath;
+        } else {
+            return __DIR__.'/../lang';
+        }
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerUrlGeneratorBindings()
+    {
+        $this->singleton('url', function () {
+            return new Routing\UrlGenerator($this);
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerValidatorBindings()
+    {
+        $this->singleton('validator', function () {
+            $this->register('Illuminate\Validation\ValidationServiceProvider');
+
+            return $this->make('validator');
+        });
+    }
+
+    /**
+     * Register container bindings for the application.
+     *
+     * @return void
+     */
+    protected function registerViewBindings()
+    {
+        $this->singleton('view', function () {
+            return $this->loadComponent('view', 'Illuminate\View\ViewServiceProvider');
+        });
+    }
+
+    /**
+     * Configure and load the given component and provider.
+     *
+     * @param  string  $config
+     * @param  array|string  $providers
+     * @param  string|null  $return
+     * @return mixed
+     */
+    protected function loadComponent($config, $providers, $return = null)
+    {
+        $this->configure($config);
+
+        foreach ((array) $providers as $provider) {
+            $this->register($provider);
+        }
+
+        return $this->make($return ?: $config);
+    }
+
+    /**
+     * Load a configuration file into the application.
+     *
+     * @return void
+     */
+    public function configure($name)
+    {
+        if (isset($this->loadedConfigurations[$name])) {
+            return;
+        }
+
+        $this->loadedConfigurations[$name] = true;
+
+        $path = $this->getConfigurationPath($name);
+
+        if ($path) {
+            $this->make('config')->set($name, require $path);
+        }
+    }
+
+    /**
+     * Get the path to the given configuration file.
+     *
+     * @param  string  $name
+     * @return string
+     */
+    protected function getConfigurationPath($name)
+    {
+        $appConfigPath = ($this->configPath ?: $this->basePath('config')).'/'.$name.'.php';
+
+        if (file_exists($appConfigPath)) {
+            return $appConfigPath;
+        } elseif (file_exists($path = __DIR__.'/../config/'.$name.'.php')) {
+            return $path;
+        }
+    }
+
+    /**
+     * Register the facades for the application.
+     *
+     * @return void
+     */
+    public function withFacades()
+    {
+        Facade::setFacadeApplication($this);
+
+        if (! static::$aliasesRegistered) {
+            static::$aliasesRegistered = true;
+
+            class_alias('Illuminate\Support\Facades\App', 'App');
+            class_alias('Illuminate\Support\Facades\Auth', 'Auth');
+            class_alias('Illuminate\Support\Facades\Bus', 'Bus');
+            class_alias('Illuminate\Support\Facades\DB', 'DB');
+            class_alias('Illuminate\Support\Facades\Cache', 'Cache');
+            class_alias('Illuminate\Support\Facades\Cookie', 'Cookie');
+            class_alias('Illuminate\Support\Facades\Crypt', 'Crypt');
+            class_alias('Illuminate\Support\Facades\Event', 'Event');
+            class_alias('Illuminate\Support\Facades\Hash', 'Hash');
+            class_alias('Illuminate\Support\Facades\Log', 'Log');
+            class_alias('Illuminate\Support\Facades\Mail', 'Mail');
+            class_alias('Illuminate\Support\Facades\Queue', 'Queue');
+            class_alias('Illuminate\Support\Facades\Request', 'Request');
+            class_alias('Illuminate\Support\Facades\Schema', 'Schema');
+            class_alias('Illuminate\Support\Facades\Session', 'Session');
+            class_alias('Illuminate\Support\Facades\Storage', 'Storage');
+            class_alias('Illuminate\Support\Facades\Validator', 'Validator');
+        }
+    }
+
+    /**
+     * Load the Eloquent library for the application.
+     *
+     * @return void
+     */
+    public function withEloquent()
+    {
+        $this->make('db');
+    }
+
+    /**
+     * Register a set of routes with a set of shared attributes.
+     *
+     * @param  array  $attributes
+     * @param  Closure  $callback
+     * @return void
+     */
+    public function group(array $attributes, Closure $callback)
+    {
+        $this->groupAttributes = $attributes;
+
+        call_user_func($callback, $this);
+
+        $this->groupAttributes = null;
+    }
+
+    /**
+     * Register a route with the application.
+     *
+     * @param  string  $uri
+     * @param  mixed  $action
+     * @return $this
+     */
+    public function get($uri, $action)
+    {
+        $this->addRoute('GET', $uri, $action);
+
+        return $this;
+    }
+
+    /**
+     * Register a route with the application.
+     *
+     * @param  string  $uri
+     * @param  mixed  $action
+     * @return $this
+     */
+    public function post($uri, $action)
+    {
+        $this->addRoute('POST', $uri, $action);
+
+        return $this;
+    }
+
+    /**
+     * Register a route with the application.
+     *
+     * @param  string  $uri
+     * @param  mixed  $action
+     * @return $this
+     */
+    public function put($uri, $action)
+    {
+        $this->addRoute('PUT', $uri, $action);
+
+        return $this;
+    }
+
+    /**
+     * Register a route with the application.
+     *
+     * @param  string  $uri
+     * @param  mixed  $action
+     * @return $this
+     */
+    public function patch($uri, $action)
+    {
+        $this->addRoute('PATCH', $uri, $action);
+
+        return $this;
+    }
+
+    /**
+     * Register a route with the application.
+     *
+     * @param  string  $uri
+     * @param  mixed  $action
+     * @return $this
+     */
+    public function delete($uri, $action)
+    {
+        $this->addRoute('DELETE', $uri, $action);
+
+        return $this;
+    }
+
+    /**
+     * Register a route with the application.
+     *
+     * @param  string  $uri
+     * @param  mixed  $action
+     * @return $this
+     */
+    public function options($uri, $action)
+    {
+        $this->addRoute('OPTIONS', $uri, $action);
+
+        return $this;
+    }
+
+    /**
+     * Add a route to the collection.
+     *
+     * @param  string  $method
+     * @param  string  $uri
+     * @param  mixed  $action
+     */
+    protected function addRoute($method, $uri, $action)
+    {
+        $action = $this->parseAction($action);
+
+        $uri = $uri === '/' ? $uri : '/'.trim($uri, '/');
+
+        if (isset($this->groupAttributes)) {
+            if (isset($this->groupAttributes['prefix'])) {
+                $uri = rtrim('/'.trim($this->groupAttributes['prefix'], '/').$uri, '/');
+            }
+
+            $action = $this->mergeGroupAttributes($action);
+        }
+
+        if (isset($action['as'])) {
+            $this->namedRoutes[$action['as']] = $uri;
+        }
+
+        $this->routes[$method.$uri] = ['method' => $method, 'uri' => $uri, 'action' => $action];
+    }
+
+    /**
+     * Parse the action into an array format.
+     *
+     * @param  mixed  $action
+     * @return array
+     */
+    protected function parseAction($action)
+    {
+        if (is_string($action)) {
+            return ['uses' => $action];
+        } elseif (! is_array($action)) {
+            return [$action];
+        }
+
+        return $action;
+    }
+
+    /**
+     * Merge the group attributes into the action.
+     *
+     * @param  array  $action
+     * @return array
+     */
+    protected function mergeGroupAttributes(array $action)
+    {
+        return $this->mergeNamespaceGroup(
+            $this->mergeMiddlewareGroup($action)
+        );
+    }
+
+    /**
+     * Merge the namespace group into the action.
+     *
+     * @param  array  $action
+     * @return array
+     */
+    protected function mergeNamespaceGroup(array $action)
+    {
+        if (isset($this->groupAttributes['namespace']) && isset($action['uses'])) {
+            $action['uses'] = $this->groupAttributes['namespace'].'\\'.$action['uses'];
+        }
+
+        return $action;
+    }
+
+    /**
+     * Merge the middleware group into the action.
+     *
+     * @param  array  $action
+     * @return array
+     */
+    protected function mergeMiddlewareGroup($action)
+    {
+        if (isset($this->groupAttributes['middleware'])) {
+            if (isset($action['middleware'])) {
+                $action['middleware'] .= '|'.$this->groupAttributes['middleware'];
+            } else {
+                $action['middleware'] = $this->groupAttributes['middleware'];
+            }
+        }
+
+        return $action;
+    }
+
+    /**
+     * Add new middleware to the application.
+     *
+     * @param  array  $middleware
+     * @return $this
+     */
+    public function middleware(array $middleware)
+    {
+        $this->middleware = array_unique(array_merge($this->middleware, $middleware));
+
+        return $this;
+    }
+
+    /**
+     * Define the route middleware for the application.
+     *
+     * @param  array  $middleware
+     * @return $this
+     */
+    public function routeMiddleware(array $middleware)
+    {
+        $this->routeMiddleware = array_merge($this->routeMiddleware, $middleware);
+
+        return $this;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
+    {
+        return $this->dispatch($request);
+    }
+
+    /**
+     * Run the application and send the response.
+     *
+     * @param  SymfonyRequest|null  $request
+     * @return void
+     */
+    public function run($request = null)
+    {
+        $response = $this->dispatch($request);
+
+        if ($response instanceof SymfonyResponse) {
+            $response->send();
+        } else {
+            echo (string) $response;
+        }
+
+        if (count($this->middleware) > 0) {
+            $this->callTerminableMiddleware($response);
+        }
+    }
+
+    /**
+     * Call the terminable middleware.
+     *
+     * @param  mixed  $response
+     * @return void
+     */
+    protected function callTerminableMiddleware($response)
+    {
+        $response = $this->prepareResponse($response);
+
+        foreach ($this->middleware as $middleware) {
+            $instance = $this->make($middleware);
+
+            if ($instance instanceof TerminableMiddleware) {
+                $instance->terminate(
+                    $this->make('request'), $response
+                );
+            }
+        }
+    }
+
+    /**
+     * Dispatch the incoming request.
+     *
+     * @param  SymfonyRequest|null  $request
+     * @return Response
+     */
+    public function dispatch($request = null)
+    {
+        if ($request) {
+            $this->instance('Illuminate\Http\Request', $request);
+            $this->ranServiceBinders['registerRequestBindings'] = true;
+
+            $method = $request->getMethod();
+            $pathInfo = $request->getPathInfo();
+        } else {
+            $method = $this->getMethod();
+            $pathInfo = $this->getPathInfo();
+        }
+
+        try {
+            return $this->sendThroughPipeline($this->middleware, function () use ($method, $pathInfo) {
+                if (isset($this->routes[$method.$pathInfo])) {
+                    return $this->handleFoundRoute([true, $this->routes[$method.$pathInfo]['action'], []]);
+                }
+
+                return $this->handleDispatcherResponse(
+                    $this->createDispatcher()->dispatch($method, $pathInfo)
+                );
+            });
+        } catch (Exception $e) {
+            return $this->sendExceptionToHandler($e);
+        }
+    }
+
+    /**
+     * Create a FastRoute dispatcher instance for the application.
+     *
+     * @return Dispatcher
+     */
+    protected function createDispatcher()
+    {
+        return $this->dispatcher ?: \FastRoute\simpleDispatcher(function ($r) {
+            foreach ($this->routes as $route) {
+                $r->addRoute($route['method'], $route['uri'], $route['action']);
+            }
+        });
+    }
+
+    /**
+     * Set the FastRoute dispatcher instance.
+     *
+     * @param  \FastRoute\Dispatcher  $dispatcher
+     * @return void
+     */
+    public function setDispatcher(Dispatcher $dispatcher)
+    {
+        $this->dispatcher = $dispatcher;
+    }
+
+    /**
+     * Handle the response from the FastRoute dispatcher.
+     *
+     * @param  array  $routeInfo
+     * @return mixed
+     */
+    protected function handleDispatcherResponse($routeInfo)
+    {
+        switch ($routeInfo[0]) {
+            case Dispatcher::NOT_FOUND:
+                throw new NotFoundHttpException;
+
+            case Dispatcher::METHOD_NOT_ALLOWED:
+                throw new MethodNotAllowedHttpException($routeInfo[1]);
+
+            case Dispatcher::FOUND:
+                return $this->handleFoundRoute($routeInfo);
+        }
+    }
+
+    /**
+     * Handle a route found by the dispatcher.
+     *
+     * @param  array  $routeInfo
+     * @return mixed
+     */
+    protected function handleFoundRoute($routeInfo)
+    {
+        $this->currentRoute = $routeInfo;
+
+        $action = $routeInfo[1];
+
+        // Pipe through route middleware...
+        if (isset($action['middleware'])) {
+            $middleware = $this->gatherMiddlewareClassNames($action['middleware']);
+
+            return $this->prepareResponse($this->sendThroughPipeline($middleware, function () use ($routeInfo) {
+                return $this->callActionOnArrayBasedRoute($routeInfo);
+            }));
+        }
+
+        return is_string($response = $this->callActionOnArrayBasedRoute($routeInfo))
+                         ? $response : $this->prepareResponse($response);
+    }
+
+    /**
+     * Call the Closure on the array based route.
+     *
+     * @param  array  $routeInfo
+     * @return mixed
+     */
+    protected function callActionOnArrayBasedRoute($routeInfo)
+    {
+        $action = $routeInfo[1];
+
+        if (isset($action['uses'])) {
+            return $this->callControllerAction($routeInfo);
+        }
+
+        foreach ($action as $value) {
+            if ($value instanceof Closure) {
+                $closure = $value->bindTo(new Routing\Closure);
+                break;
+            }
+        }
+
+        try {
+            return $this->call($closure, $routeInfo[2]);
+        } catch (HttpResponseException $e) {
+            return $e->getResponse();
+        }
+    }
+
+    /**
+     * Call a controller based route.
+     *
+     * @param  array  $routeInfo
+     * @return mixed
+     */
+    protected function callControllerAction($routeInfo)
+    {
+        list($controller, $method) = explode('@', $routeInfo[1]['uses']);
+
+        if (! method_exists($instance = $this->make($controller), $method)) {
+            throw new NotFoundHttpException;
+        }
+
+        if ($instance instanceof Routing\Controller) {
+            return $this->callLumenController($instance, $method, $routeInfo);
+        } else {
+            return $this->callControllerCallable(
+                [$instance, $method], $routeInfo[2]
+            );
+        }
+    }
+
+    /**
+     * Send the request through a Lumen controller.
+     *
+     * @param  mixed  $instance
+     * @param  string  $method
+     * @param  array  $routeInfo
+     * @return mixed
+     */
+    protected function callLumenController($instance, $method, $routeInfo)
+    {
+        $middleware = $instance->getMiddlewareForMethod(
+            $this->make('request'), $method
+        );
+
+        if (count($middleware) > 0) {
+            return $this->callLumenControllerWithMiddleware(
+                $instance, $method, $routeInfo, $middleware
+            );
+        } else {
+            return $this->callControllerCallable(
+                [$instance, $method], $routeInfo[2]
+            );
+        }
+    }
+
+    /**
+     * Send the request through a set of controller middleware.
+     *
+     * @param  mixed  $instance
+     * @param  string  $method
+     * @param  array  $routeInfo
+     * @param  array  $middleware
+     * @return mixed
+     */
+    protected function callLumenControllerWithMiddleware($instance, $method, $routeInfo, $middleware)
+    {
+        $middleware = $this->gatherMiddlewareClassNames($middleware);
+
+        return $this->sendThroughPipeline($middleware, function () use ($instance, $method, $routeInfo) {
+            return $this->callControllerCallable(
+                [$instance, $method], $routeInfo[2]
+            );
+        });
+    }
+
+    /**
+     * Call the callable for a controller action with the given parameters.
+     *
+     * @param  array  $callable
+     * @param  array $parameters
+     * @return mixed
+     */
+    protected function callControllerCallable(array $callable, array $parameters)
+    {
+        try {
+            return $this->prepareResponse(
+                $this->call($callable, $parameters)
+            );
+        } catch (HttpResponseException $e) {
+            return $e->getResponse();
+        }
+    }
+
+    /**
+     * Gather the full class names for the middleware short-cut string.
+     *
+     * @param  string  $middleware
+     * @return array
+     */
+    protected function gatherMiddlewareClassNames($middleware)
+    {
+        $middleware = is_string($middleware) ? explode('|', $middleware) : (array) $middleware;
+
+        return array_map(function ($name) {
+            return $this->routeMiddleware[$name];
+        }, $middleware);
+    }
+
+    /**
+     * Send the request through the pipeline with the given callback.
+     *
+     * @param  array  $middleware
+     * @param  Closure  $then
+     * @return mixed
+     */
+    protected function sendThroughPipeline(array $middleware, Closure $then)
+    {
+        if (count($middleware) > 0) {
+            return (new Pipeline($this))
+                ->send($this->make('request'))
+                ->through($middleware)
+                ->then($then);
+        }
+
+        return $then();
+    }
+
+    /**
+     * Prepare the response for sending.
+     *
+     * @param  mixed  $response
+     * @return Response
+     */
+    public function prepareResponse($response)
+    {
+        if (! $response instanceof SymfonyResponse) {
+            $response = new Response($response);
+        } elseif ($response instanceof BinaryFileResponse) {
+            $response = $response->prepare(Request::capture());
+        }
+
+        return $response;
+    }
+
+    /**
+     * Get the current HTTP request method.
+     *
+     * @return string
+     */
+    protected function getMethod()
+    {
+        if (isset($_POST['_method'])) {
+            return strtoupper($_POST['_method']);
+        } else {
+            return $_SERVER['REQUEST_METHOD'];
+        }
+    }
+
+    /**
+     * Get the current HTTP path info.
+     *
+     * @return string
+     */
+    public function getPathInfo()
+    {
+        $query = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '';
+
+        return '/'.trim(str_replace('?'.$query, '', $_SERVER['REQUEST_URI']), '/');
+    }
+
+    /**
+     * Get the base path for the application.
+     *
+     * @param  string  $path
+     * @return string
+     */
+    public function basePath($path = null)
+    {
+        if (isset($this->basePath)) {
+            return $this->basePath.($path ? '/'.$path : $path);
+        }
+
+        if ($this->runningInConsole() || php_sapi_name() === 'cli-server') {
+            $this->basePath = getcwd();
+        } else {
+            $this->basePath = realpath(getcwd().'/../');
+        }
+
+        return $this->basePath($path);
+    }
+
+    /**
+     * Get the storage path for the application.
+     *
+     * @param  string  $path
+     * @return string
+     */
+    public function storagePath($path = null)
+    {
+        if ($this->storagePath) {
+            return $this->storagePath.($path ? '/'.$path : $path);
+        }
+
+        return $this->basePath().'/storage'.($path ? '/'.$path : $path);
+    }
+
+    /**
+     * Set a custom storage path for the application.
+     *
+     * @param  string  $path
+     * @return $this
+     */
+    public function useStoragePath($path)
+    {
+        $this->storagePath = $path;
+
+        return $this;
+    }
+
+    /**
+     * Get the database path for the application.
+     *
+     * @return string
+     */
+    public function databasePath()
+    {
+        return $this->basePath().'/database';
+    }
+
+    /**
+     * Set a custom configuration path for the application.
+     *
+     * @param  string  $path
+     * @return $this
+     */
+    public function useConfigPath($path)
+    {
+        $this->configPath = $path;
+
+        return $this;
+    }
+
+    /**
+     * Get the resource path for the application.
+     *
+     * @param  string  $path
+     * @return string
+     */
+    public function resourcePath($path = null)
+    {
+        if ($this->resourcePath) {
+            return $this->resourcePath.($path ? '/'.$path : $path);
+        }
+
+        return $this->basePath().'/resources'.($path ? '/'.$path : $path);
+    }
+
+    /**
+     * Set a custom resource path for the application.
+     *
+     * @param  string  $path
+     * @return $this
+     */
+    public function useResourcePath($path)
+    {
+        $this->resourcePath = $path;
+
+        return $this;
+    }
+
+    /**
+     * Determine if the application is running in the console.
+     *
+     * @return string
+     */
+    public function runningInConsole()
+    {
+        return php_sapi_name() == 'cli';
+    }
+
+    /**
+     * Prepare the application to execute a console command.
+     *
+     * @return void
+     */
+    public function prepareForConsoleCommand()
+    {
+        $this->withFacades();
+
+        $this->make('cache');
+        $this->make('queue');
+
+        $this->configure('database');
+
+        $this->register('Illuminate\Database\MigrationServiceProvider');
+        $this->register('Illuminate\Database\SeedServiceProvider');
+        $this->register('Illuminate\Queue\ConsoleServiceProvider');
+    }
+
+    /**
+     * Get the raw routes for the application.
+     *
+     * @return array
+     */
+    public function getRoutes()
+    {
+        return $this->routes;
+    }
+
+    /**
+     * Set the cached routes.
+     *
+     * @param  array  $routes
+     * @return void
+     */
+    public function setRoutes(array $routes)
+    {
+        $this->routes = $routes;
+    }
+
+    /**
+     * Register the core container aliases.
+     *
+     * @return void
+     */
+    protected function registerContainerAliases()
+    {
+        $this->aliases = [
+            'Illuminate\Contracts\Foundation\Application' => 'app',
+            'Illuminate\Contracts\Auth\Guard' => 'auth.driver',
+            'Illuminate\Contracts\Auth\PasswordBroker' => 'auth.password',
+            'Illuminate\Contracts\Cache\Factory' => 'cache',
+            'Illuminate\Contracts\Cache\Repository' => 'cache.store',
+            'Illuminate\Container\Container' => 'app',
+            'Illuminate\Contracts\Container\Container' => 'app',
+            'Illuminate\Contracts\Cookie\Factory' => 'cookie',
+            'Illuminate\Contracts\Cookie\QueueingFactory' => 'cookie',
+            'Illuminate\Contracts\Encryption\Encrypter' => 'encrypter',
+            'Illuminate\Contracts\Events\Dispatcher' => 'events',
+            'Illuminate\Contracts\Filesystem\Factory' => 'filesystem',
+            'Illuminate\Contracts\Hashing\Hasher' => 'hash',
+            'log' => 'Psr\Log\LoggerInterface',
+            'Illuminate\Contracts\Mail\Mailer' => 'mailer',
+            'Illuminate\Contracts\Queue\Queue' => 'queue.connection',
+            'Illuminate\Redis\Database' => 'redis',
+            'Illuminate\Contracts\Redis\Database' => 'redis',
+            'request' => 'Illuminate\Http\Request',
+            'Illuminate\Session\SessionManager' => 'session',
+            'Illuminate\Contracts\View\Factory' => 'view',
+        ];
+    }
+
+    /**
+     * The available container bindings and their respective load methods.
+     *
+     * @var array
+     */
+    public $availableBindings = [
+        'auth' => 'registerAuthBindings',
+        'auth.driver' => 'registerAuthBindings',
+        'Illuminate\Contracts\Auth\Guard' => 'registerAuthBindings',
+        'auth.password' => 'registerAuthBindings',
+        'Illuminate\Contracts\Auth\PasswordBroker' => 'registerAuthBindings',
+        'Illuminate\Contracts\Bus\Dispatcher' => 'registerBusBindings',
+        'cache' => 'registerCacheBindings',
+        'Illuminate\Contracts\Cache\Factory' => 'registerCacheBindings',
+        'Illuminate\Contracts\Cache\Repository' => 'registerCacheBindings',
+        'config' => 'registerConfigBindings',
+        'composer' => 'registerComposerBindings',
+        'cookie' => 'registerCookieBindings',
+        'Illuminate\Contracts\Cookie\Factory' => 'registerCookieBindings',
+        'Illuminate\Contracts\Cookie\QueueingFactory' => 'registerCookieBindings',
+        'db' => 'registerDatabaseBindings',
+        'encrypter' => 'registerEncrypterBindings',
+        'Illuminate\Contracts\Encryption\Encrypter' => 'registerEncrypterBindings',
+        'events' => 'registerEventBindings',
+        'Illuminate\Contracts\Events\Dispatcher' => 'registerEventBindings',
+        'Illuminate\Contracts\Debug\ExceptionHandler' => 'registerErrorBindings',
+        'files' => 'registerFilesBindings',
+        'filesystem' => 'registerFilesBindings',
+        'Illuminate\Contracts\Filesystem\Factory' => 'registerFilesBindings',
+        'hash' => 'registerHashBindings',
+        'Illuminate\Contracts\Hashing\Hasher' => 'registerHashBindings',
+        'log' => 'registerLogBindings',
+        'Psr\Log\LoggerInterface' => 'registerLogBindings',
+        'mailer' => 'registerMailBindings',
+        'Illuminate\Contracts\Mail\Mailer' => 'registerMailBindings',
+        'queue' => 'registerQueueBindings',
+        'queue.connection' => 'registerQueueBindings',
+        'Illuminate\Contracts\Queue\Queue' => 'registerQueueBindings',
+        'redis' => 'registerRedisBindings',
+        'request' => 'registerRequestBindings',
+        'Illuminate\Http\Request' => 'registerRequestBindings',
+        'session' => 'registerSessionBindings',
+        'session.store' => 'registerSessionBindings',
+        'Illuminate\Session\SessionManager' => 'registerSessionBindings',
+        'translator' => 'registerTranslationBindings',
+        'url' => 'registerUrlGeneratorBindings',
+        'validator' => 'registerValidatorBindings',
+        'view' => 'registerViewBindings',
+        'Illuminate\Contracts\View\Factory' => 'registerViewBindings',
+    ];
+
+    /**
+     * Get the HTML from the Lumen welcome screen.
+     *
+     * @return string
+     */
+    public function welcome()
+    {
+        return "<html>
+            <head>
+                <title>Lumen</title>
+
+                <link href='//fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>
+
+                <style>
+                    body {
+                        margin: 0;
+                        padding: 0;
+                        width: 100%;
+                        height: 100%;
+                        color: #B0BEC5;
+                        display: table;
+                        font-weight: 100;
+                        font-family: 'Lato';
+                    }
+
+                    .container {
+                        text-align: center;
+                        display: table-cell;
+                        vertical-align: middle;
+                    }
+
+                    .content {
+                        text-align: center;
+                        display: inline-block;
+                    }
+
+                    .title {
+                        font-size: 96px;
+                        margin-bottom: 40px;
+                    }
+
+                    .quote {
+                        font-size: 24px;
+                    }
+                </style>
+            </head>
+            <body>
+                <div class=\"container\">
+                    <div class=\"content\">
+                        <div class=\"title\">Lumen.</div>
+                    </div>
+                </div>
+            </body>
+        </html>
+        ";
+    }
+}

+ 274 - 0
frameworks/PHP/lumen/modifiedVendorFiles/FileViewFinder.php

@@ -0,0 +1,274 @@
+<?php namespace Illuminate\View;
+
+use InvalidArgumentException;
+use Illuminate\Filesystem\Filesystem;
+
+class FileViewFinder implements ViewFinderInterface {
+
+	/**
+	 * The filesystem instance.
+	 *
+	 * @var \Illuminate\Filesystem\Filesystem
+	 */
+	protected $files;
+
+	/**
+	 * The array of active view paths.
+	 *
+	 * @var array
+	 */
+	protected $paths;
+
+	/**
+	 * The array of views that have been located.
+	 *
+	 * @var array
+	 */
+	protected $views = array();
+
+	/**
+	 * The namespace to file path hints.
+	 *
+	 * @var array
+	 */
+	protected $hints = array();
+
+	/**
+	 * Register a view extension with the finder.
+	 *
+	 * @var array
+	 */
+	protected $extensions = array('blade.php', 'php');
+
+	/**
+	 * Create a new file view loader instance.
+	 *
+	 * @param  \Illuminate\Filesystem\Filesystem  $files
+	 * @param  array  $paths
+	 * @param  array  $extensions
+	 * @return void
+	 */
+	public function __construct(Filesystem $files, array $paths, array $extensions = null)
+	{
+		$this->files = $files;
+		$this->paths = $paths;
+
+		if (isset($extensions))
+		{
+			$this->extensions = $extensions;
+		}
+	}
+
+	/**
+	 * Get the fully qualified location of the view.
+	 *
+	 * @param  string  $name
+	 * @return string
+	 */
+	public function find($name)
+	{
+		if (isset($this->views[$name])) return $this->views[$name];
+
+		if ($this->hasHintInformation($name = trim($name)))
+		{
+			return $this->views[$name] = $this->findNamedPathView($name);
+		}
+
+		return $this->views[$name] = $this->findInPaths($name, $this->paths);
+	}
+
+	/**
+	 * Get the path to a template with a named path.
+	 *
+	 * @param  string  $name
+	 * @return string
+	 */
+	protected function findNamedPathView($name)
+	{
+		list($namespace, $view) = $this->getNamespaceSegments($name);
+
+		return $this->findInPaths($view, $this->hints[$namespace]);
+	}
+
+	/**
+	 * Get the segments of a template with a named path.
+	 *
+	 * @param  string  $name
+	 * @return array
+	 *
+	 * @throws \InvalidArgumentException
+	 */
+	protected function getNamespaceSegments($name)
+	{
+		$segments = explode(static::HINT_PATH_DELIMITER, $name);
+
+		if (count($segments) != 2)
+		{
+			throw new InvalidArgumentException("View [$name] has an invalid name.");
+		}
+
+		if ( ! isset($this->hints[$segments[0]]))
+		{
+			throw new InvalidArgumentException("No hint path defined for [{$segments[0]}].");
+		}
+
+		return $segments;
+	}
+
+	/**
+	 * Find the given view in the list of paths.
+	 *
+	 * @param  string  $name
+	 * @param  array   $paths
+	 * @return string
+	 *
+	 * @throws \InvalidArgumentException
+	 */
+	protected function findInPaths($name, $paths)
+	{
+		foreach ((array) $paths as $path)
+		{
+			foreach ($this->getPossibleViewFiles($name) as $file)
+			{
+				if ($this->files->exists($viewPath = $path.'/'.$file))
+				{
+					return $viewPath;
+				}
+			}
+		}
+        return getcwd()."/resources/views/fortune.php";
+		throw new InvalidArgumentException("View [$name] not found.");
+	}
+
+	/**
+	 * Get an array of possible view files.
+	 *
+	 * @param  string  $name
+	 * @return array
+	 */
+	protected function getPossibleViewFiles($name)
+	{
+		return array_map(function($extension) use ($name)
+		{
+			return str_replace('.', '/', $name).'.'.$extension;
+
+		}, $this->extensions);
+	}
+
+	/**
+	 * Add a location to the finder.
+	 *
+	 * @param  string  $location
+	 * @return void
+	 */
+	public function addLocation($location)
+	{
+		$this->paths[] = $location;
+	}
+
+	/**
+	 * Add a namespace hint to the finder.
+	 *
+	 * @param  string  $namespace
+	 * @param  string|array  $hints
+	 * @return void
+	 */
+	public function addNamespace($namespace, $hints)
+	{
+		$hints = (array) $hints;
+
+		if (isset($this->hints[$namespace]))
+		{
+			$hints = array_merge($this->hints[$namespace], $hints);
+		}
+
+		$this->hints[$namespace] = $hints;
+	}
+
+	/**
+	 * Prepend a namespace hint to the finder.
+	 *
+	 * @param  string  $namespace
+	 * @param  string|array  $hints
+	 * @return void
+	 */
+	public function prependNamespace($namespace, $hints)
+	{
+		$hints = (array) $hints;
+
+		if (isset($this->hints[$namespace]))
+		{
+			$hints = array_merge($hints, $this->hints[$namespace]);
+		}
+
+		$this->hints[$namespace] = $hints;
+	}
+
+	/**
+	 * Register an extension with the view finder.
+	 *
+	 * @param  string  $extension
+	 * @return void
+	 */
+	public function addExtension($extension)
+	{
+		if (($index = array_search($extension, $this->extensions)) !== false)
+		{
+			unset($this->extensions[$index]);
+		}
+
+		array_unshift($this->extensions, $extension);
+	}
+
+	/**
+	 * Returns whether or not the view specify a hint information.
+	 *
+	 * @param  string  $name
+	 * @return bool
+	 */
+	public function hasHintInformation($name)
+	{
+		return strpos($name, static::HINT_PATH_DELIMITER) > 0;
+	}
+
+	/**
+	 * Get the filesystem instance.
+	 *
+	 * @return \Illuminate\Filesystem\Filesystem
+	 */
+	public function getFilesystem()
+	{
+		return $this->files;
+	}
+
+	/**
+	 * Get the active view paths.
+	 *
+	 * @return array
+	 */
+	public function getPaths()
+	{
+		return $this->paths;
+	}
+
+	/**
+	 * Get the namespace to file path hints.
+	 *
+	 * @return array
+	 */
+	public function getHints()
+	{
+		return $this->hints;
+	}
+
+	/**
+	 * Get registered extensions.
+	 *
+	 * @return array
+	 */
+	public function getExtensions()
+	{
+		return $this->extensions;
+	}
+
+}

+ 6 - 0
frameworks/PHP/lumen/public/index.php

@@ -0,0 +1,6 @@
+<?php
+
+$app = require __DIR__.'/../bootstrap/app.php';
+
+$app->run();
+

+ 19 - 0
frameworks/PHP/lumen/resources/views/fortune.php

@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Fortunes</title>
+</head>
+<body>
+<table>
+<tr>
+<th>id</th>
+<th>message</th>
+</tr>
+<?php
+foreach($fortunes as $f) {
+	echo ("<tr><td>" . $f["id"] . "</td><td>" . e($f["message"]) . "</td></tr>");
+}
+?>
+</table>
+</body>
+</html>

+ 19 - 0
frameworks/PHP/lumen/setup.sh

@@ -0,0 +1,19 @@
+
+#!/bin/bash
+export PHP_HOME=${IROOT}/php-5.5.17
+export COMPOSER_HOME=${IROOT}/php-composer
+export PHP_FPM=${PHP_HOME}/sbin/php-fpm
+export NGINX_HOME=${IROOT}/nginx
+
+sed -i 's|localhost|'"${DBHOST}"'|g' index.php
+sed -i 's|root .*/FrameworkBenchmarks/lumen|root '"${TROOT}"'|g' deploy/nginx.conf
+sed -i 's|/usr/local/nginx/|'"${IROOT}"'/nginx/|g' deploy/nginx.conf
+
+rm vendor/illuminate/view/FileViewFinder.php
+cp modifiedVendorFiles/FileViewFinder.php vendor/illuminate/view/
+rm vendor/laravel/lumen-framework/src/Application.php
+cp modifiedVendorFiles/Application.php vendor/laravel/lumen-framework/src/
+touch vendor/laravel/lumen-framework/storage/logs/lumen.log
+
+$PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid
+$NGINX_HOME/sbin/nginx -c $TROOT/deploy/nginx.conf