Coder Social home page Coder Social logo

cr0wst / laravel-container-info Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 55 KB

Artisan commands for getting information from the Laravel container.

License: MIT License

PHP 100.00%
laravel-container artisan laravel php binding registered-bindings

laravel-container-info's Introduction

Laravel Container Info

Latest Stable Version Latest Unstable Version Total Downloads Build Status

This is a suite of custom commands for Artisan that gives information about the IoC container. The following commands are added:

Working with Bindings

  • binding:list - Lists the registered bindings by showing the abstract (interface) and concrete class that will be injected.
    • --include-illuminate - Indicates that Illuminate classes should be included. They are not included by default.
  • binding:usage - Lists the registered bindings and which files they are referenced in. By default will exclude node_modules and vendor.
    • --include-illuminate - Indicates that Illuminate classes should be included. They are not included by default.
    • --include-vendor - Indicates that the vendor directory should be included. It is not included by default.
    • --exclude= - A comma separated string that indicates which directories to exclude.
    • --sort - Indicates that the information should be sorted.

Working with Service Providers

  • provider:list - Lists the registered service providers.
    • --include-illuminate - Indicates that Illuminate classes should be included. They are not included by default.
    • --sort - Indicates that the information should be sorted.

Usage

Install Through Composer

composer require smcrow/laravel-container-info --dev

Register the Command

Laravel 5.5

Laravel 5.5 allows for the auto-discovery of service providers. The ContainerInformationProvider will automatically be discovered.

Pre Laravel 5.5

You'll need to register the command in order for it to be usable. Modify the register method of AppServiceProvider This will add the provider for the local environment:

public function register()
{
    if ($this->app->environment() === 'local') {
        $this->app->register(ContainerInformationProvider::class);
    }
}

Example Usage

php artisan binding:list

Here's sample output from the binding:list command from my LeaseTracker application.

+-----------------------------------------------------------------+--------------------------------------------------------------+
| Abstract                                                        | Concrete                                                     |
+-----------------------------------------------------------------+--------------------------------------------------------------+
| Illuminate\Contracts\Http\Kernel                                | LeaseTracker\Http\Kernel                                     |
| Illuminate\Contracts\Console\Kernel                             | LeaseTracker\Console\Kernel                                  |
| Illuminate\Contracts\Debug\ExceptionHandler                     | LeaseTracker\Exceptions\Handler                              |
| Illuminate\Session\Middleware\StartSession                      | Illuminate\Session\Middleware\StartSession                   |
| LeaseTracker\Services\Vehicle\VehicleServiceInterface           | LeaseTracker\Services\Vehicle\VehicleService                 |
| LeaseTracker\Services\Mileage\MileageServiceInterface           | LeaseTracker\Services\Mileage\MileageService                 |
| LeaseTracker\Services\Calculation\CalculationServiceInterface   | LeaseTracker\Services\Calculation\CalculationService         |
| LeaseTracker\Services\VehicleImage\VehicleImageServiceInterface | LeaseTracker\Services\VehicleImage\GoogleVehicleImageService |
| LeaseTracker\Repositories\VehicleRepositoryInterface            | LeaseTracker\Repositories\VehicleRepository                  |
| LeaseTracker\Repositories\MileEntryRepositoryInterface          | LeaseTracker\Repositories\MileEntryRepository                |
| Illuminate\Console\Scheduling\ScheduleFinishCommand             | Illuminate\Console\Scheduling\ScheduleFinishCommand          |
| Illuminate\Console\Scheduling\ScheduleRunCommand                | Illuminate\Console\Scheduling\ScheduleRunCommand             |
| Illuminate\Contracts\Pipeline\Hub                               | Illuminate\Pipeline\Hub                                      |
+-----------------------------------------------------------------+--------------------------------------------------------------+
php artisan provider:list

Here's sample output from a dummy application:

+-----------------------------------------------------------------------------+----------+----------------+
| Providers                                                                   | Deferred | Provides       |
+-----------------------------------------------------------------------------+----------+----------------+
| Fideloper\Proxy\TrustedProxyServiceProvider                                 |          |                |
| Smcrow\ContainerInformation\BindingInformation\BindingInformationProvider   |          |                |
| Smcrow\ContainerInformation\ProviderInformation\ProviderInformationProvider |          |                |
| Smcrow\ContainerInformation\ContainerInformationProvider                    |          |                |
| App\Providers\AppServiceProvider                                            |          |                |
| App\Providers\AuthServiceProvider                                           |          |                |
| App\Providers\EventServiceProvider                                          |          |                |
| App\Providers\RouteServiceProvider                                          |          |                |
| Laravel\Tinker\TinkerServiceProvider                                        | true     | command.tinker |
+-----------------------------------------------------------------------------+----------+----------------+

Feedback and Contributions

Please feel free to offer suggestions by submitting an Issue. Alternatively, submit a pull request with any features you wish to add. This is a work-in-progress, and I would welcome any and all feedback.

laravel-container-info's People

Contributors

cr0wst avatar sbine avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sbine

laravel-container-info's Issues

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.