guardsmanpanda/larabear
最新稳定版本:v2.0.0
Composer 安装命令:
composer require guardsmanpanda/larabear
包简介
Make Project Strong Like Bear.
README 文档
README
Larabear
Make Laravel strong like bear!
Installation
You can install the package via composer:
Step 1
composer require guardsmanpanda/larabear
Step 2
Add the Service provider to config/app.php:
'providers' => [ Illuminate\Auth\AuthServiceProvider::class, Illuminate\Broadcasting\BroadcastServiceProvider::class, ... \GuardsmanPanda\Larabear\Infrastructure\Laravel\Provider\BearServiceProvider::class, ],
Step 3
Publish the required config file:
php artisan vendor:publish --tag=bear
Step 4
To test and verify that the system is configured properly you can run
php artisan bear
Step 5
To enable the majority of the functionality make sure that the "BearInitiateMiddleware" is enabled on all routes
final class HttpKernel extends Kernel { // These middlewares are run during every request to your application. protected $middleware = [ \GuardsmanPanda\Larabear\Infrastructure\Http\Middleware\BearInitiateMiddleware::class, OtherMiddleware::class, ];
Step 6
To filter console output from "php artisan" changed main artisan file to:
#!/usr/bin/env php <?php declare(strict_types=1); use GuardsmanPanda\Larabear\Infrastructure\Console\Service\ConsoleOutputFilter; define('LARAVEL_START', microtime(true)); require __DIR__.'/vendor/autoload.php'; $app = require __DIR__.'/bootstrap/app.php'; $kernel = $app->make(Illuminate\Contracts\Console\Kernel::class); $status = $kernel->handle($input = new Symfony\Component\Console\Input\ArgvInput, new ConsoleOutputFilter); $kernel->terminate($input, $status); exit($status);
Usage
You can get proper type check data from the request by using the "Req" class:
final class MyController extends Controller { public function myMethod(): JsonResponse { $data = Req::getString('data');
Security
If you discover any security related issues, please email guardsmanpanda@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 10.98k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-10