Coder Social home page Coder Social logo

larabear's Introduction

Latest Version on Packagist Total Downloads

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 [email protected] instead of using the issue tracker.


Credits


License

The MIT License (MIT). Please see License File for more information.

larabear's People

Contributors

guardsmanpanda avatar sanderha avatar gnrxgripping avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.