int/lumen-base

为微服务提供基础 Integrando.se

v0.1.31 2017-08-01 22:57 UTC

README

composer require int/lumen-base

修改 ./bootstrap/app.php

启用 Facades

// $app->withFacades();

$app->withFacades();
修改异常处理程序。

$app->singleton(
    Illuminate\Contracts\Debug\ExceptionHandler::class,
    App\Exceptions\Handler::clas
);

$app->singleton(
    Illuminate\Contracts\Debug\ExceptionHandler::class,
    \Int\Lumen\Core\Exceptions\Handler::class
);
添加 Middleware Accepts Json
$app->middleware([
    \Int\Lumen\Core\Http\Middleware\AcceptsJsonMiddleware::class
]);
添加 Transformer 服务提供者
$app->register(\Int\Lumen\Core\Providers\TransformerServiceProvider::class);
添加配置到 Monolog
$app->configureMonologUsing(function ($monolog) {

    $monolog->pushHandler(new \Monolog\Handler\StreamHandler(storage_path() . '/logs/api.log'));
    $monolog->pushProcessor(new \Monolog\Processor\WebProcessor);

    return $monolog;
});