berry-beans/service-container-debugger 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

berry-beans/service-container-debugger

Composer 安装命令:

composer require berry-beans/service-container-debugger

包简介

Inspect the Laravel IoC Container from Artisan.

README 文档

README

The container debug command can be used to inspect the Laravel 5 service container. It's similar to the container:debug from the Symfony framework. It will show a list of all bindings, their types, values if scalar, and the time it takes to resolve each binding.

Installation

Add the following dependency to your Laravel project:

"berry-beans/service-container-debugger": "dev-master"

Now run...

composer update

to download the package. Now add the service provider to your project configuration at config/app.php.

'providers' => array(
    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    'Illuminate\Cache\CacheServiceProvider',
    'Illuminate\Foundation\Providers\CommandCreatorServiceProvider',
    --- more ---
    'BerryBeans\ServiceContainerDebugger\ServiceContainerDebuggerServiceProvider',
),

Now you can execute the command using the Artisan CLI tool.

Usage

php artisan container:debug

You will see an output similar to the following.

+--------------------------+------------------------------------------------------------+----------------------+
| Identifier               | Service                                                    | Resolution time (ms) |
+--------------------------+------------------------------------------------------------+----------------------+
| artisan                  | Illuminate\Console\Application                             | 0.011                |
| asset.publisher          | Illuminate\Foundation\AssetPublisher                       | 0.020                |
| auth                     | Illuminate\Auth\AuthManager                                | 0.023                |
| auth.reminder            | Unable to resolve service.                                 | N/A                  |
| auth.reminder.repository | Unable to resolve service.                                 | N/A                  |
| cache                    | Illuminate\Cache\CacheManager                              | 0.044                |
| command.asset.publish    | Illuminate\Foundation\Console\AssetPublishCommand          | 0.058                |
| command.auth.reminders   | Illuminate\Auth\Console\MakeRemindersCommand               | 0.029                |
| command.cache.clear      | Illuminate\Cache\Console\ClearCommand                      | 0.023                |
| command.dump-autoload    | Illuminate\Foundation\Console\AutoloadCommand              | 0.022                |
| command.environment      | Illuminate\Foundation\Console\EnvironmentCommand           | 0.023                |
| command.key.generate     | Illuminate\Foundation\Console\KeyGenerateCommand           | 0.022                |
| env                      | <string> "production"                                      | 0.017                |
| events                   | Illuminate\Events\Dispatcher                               | 0.018                |
| exception                | Illuminate\Exception\Handler                               | 0.019                |
| exception.debug          | Illuminate\Exception\WhoopsDisplayer                       | 0.018                |
+--------------------------+------------------------------------------------------------+----------------------+

The first column contains the identifier for the service within the IoC container.

The second column contains information about the service which depends on its type:

  • (Scalar Value) The type and value. e.g "foo"
  • (Non Scalar Value) The type of the value. e.g
  • (Object) The class name of the object. e.g DateTime

If an exception is thrown when the service is resolved, then the column will show 'Unable to resolve service.'.

The third column displays the time taken to resolve the service from the IoC container in milliseconds.

Possible Uses

  • Quick lookup of container objects : php artisan container:debug | grep "mail"
  • Find which classes are represented by Facades to container objects.
  • Diagnose performance issues by studying resolution times of container objects.

Enjoy, and as always, star the repo and tell your friends!

统计信息

  • 总下载量: 669
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-07