Make Laravel strong like bear!
You can install the package via composer:
composer require guardsmanpanda/larabear
Add the Service provider to config/app.php:
'providers' => [
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
...
\GuardsmanPanda\Larabear\Infrastructure\Laravel\Provider\BearServiceProvider::class,
],
Publish the required config file:
php artisan vendor:publish --tag=bear
To test and verify that the system is configured properly you can run
php artisan bear
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,
];
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);
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');
If you discover any security related issues, please email guardsmanpanda@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.