guardsmanpanda / larabear
Make Project Strong Like Bear.
Installs: 9 319
Dependents: 3
Suggesters: 0
Security: 0
Stars: 5
Watchers: 4
Forks: 4
Open Issues: 0
Requires
- php: ^8.2
- ext-pdo: *
- ext-zend-opcache: *
- doctrine/dbal: ^4.0.3
- guzzlehttp/guzzle: ^7.8
- laravel/framework: ^v11.15
- ramsey/collection: ^2.0
Requires (Dev)
- ergebnis/phpstan-rules: ^2.2
- phpstan/phpstan: ^1.11
- phpstan/phpstan-deprecation-rules: ^1.2
- phpstan/phpstan-strict-rules: ^1.6
- roave/security-advisories: dev-latest
- thecodingmachine/phpstan-strict-rules: ^1.0
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.