int / lumen-base
为微服务提供基础 Integrando.se
v0.1.31
2017-08-01 22:57 UTC
Requires
- league/fractal: ^0.16.0
This package is not auto-updated.
Last update: 2024-09-29 03:20:43 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;
});