Instant support for PHP Code Sniffer, PHP CS Fixer, and PHP MD in the Artisan CLI







BCA Inspector Tools for Laravel

Build Status Dependencies Status Coverage Status

Latest Stable Version Total Downloads License

Inspect your code via the Artisan CLI using industry-standard tools.

This Laravel 4 package adds several pre-configured tools to the Artisan CLI, speeding up your development process and making your code cleaner.

The tools currently provided are:


1. Add the package to Composer

This package should be installed via Composer. You may either edit your project's composer.json file to require bca/laravel-inspect or via the command line.

composer require bca/laravel-inspect:~1.3

2. Add the service provider

Once the package has been successfully installed, the final step is to add the service provider. Open app/config/app.php, and add a new item to the providers array:


3. Enjoy!

That's all, folks! Just type ./artisan from the root directory of your Laravel installation to see your new tools!

Advanced Usage

We've crafted rules for the tools that we've provided that match the coding style of the Laravel project itself. That said, one size doesn't fit all, and there is no reason why you can't use the PEAR style guide, PSR-2, or invent one of your own!

Custom Rulesets

Both PHP Code Sniffer and PHP Mess Detector support the creation of custom rulesets.

PHP Code Sniffer

To create a custom ruleset for use with the inspect:sniff command just drop a ruleset named phpcs.xml in Laravel's app directory. You may then use this annotated ruleset as a guide in creating your own.

You may also run php artisan inspect:sniff --install-ruleset to copy our rules to your project so that you can modify them.

PHP Mess Detector

To create a custom ruleset for use with the inspect:mess command just drop a ruleset named phpmd.xml in Laravel's app directory. The PHPMD website offers instructions on how to create a ruleset.

You may also run php artisan inspect:mess --install-ruleset to copy our rules to your project so that you can modify them.


This project will be maintained on Github at https://github.com/brodkinca/BCA-Laravel-Inspect. You will also find this project's Issue Tracker there.


This library will be maintained under the Semantic Versioning guidelines.

Releases will be numbered with the following format:


And constructed with the following guidelines:

  • Breaking backward compatibility bumps the major (and resets the minor and patch)
  • New additions without breaking backward compatibility bumps the minor (and resets the patch)
  • Bug fixes and misc changes bump the patch

For more information on SemVer, please visit http://semver.org/.


Due to the peculiarities of the Artisan CLI it is not possible to run the unit tests outside of the context of a full Laravel application. Instead, this package should be installed within a copy of Laravel, as a workbench application, and then added to that installation's phpunit.xml file. For this reason it is recommended that you run a development copy of Laravel for package development.

Please run all unit tests before submitting any code!

NOTE: Running the unit tests will erase any phpcs/phpmd configuration files in your app directory without warning!!!