示例#1
0
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| Here we will load the environment and create the application instance
| that serves as the central piece of this framework. We'll use this
| application as an "IoC" container and router for this framework.
|
*/
$app = new Laravel\Lumen\Application(realpath(__DIR__ . '/../'));
if (env('APP_USE_LOG_SERVER', false) === true) {
    $app->configureMonologUsing(function (\Monolog\Logger $monolog) {
        $logServer = env('APP_LOG_SERVER', 'logs');
        $publisher = new \Gelf\Publisher(new \Gelf\Transport\UdpTransport($logServer));
        $handler = new \Monolog\Handler\GelfHandler($publisher);
        $handler->pushProcessor(new \Monolog\Processor\WebProcessor());
        $handler->pushProcessor(new \Monolog\Processor\UidProcessor());
        $monolog->pushHandler($handler);
        return $monolog;
    });
}
$app->withFacades();
$app->withEloquent();
/*
|--------------------------------------------------------------------------
| Register Container Bindings
|--------------------------------------------------------------------------
|
| Now we will register a few bindings in the service container. We will
| register the exception handler and the console kernel. You may add
| your own bindings here if you like or you can make another file.