Skip to content

Instantly share code, notes, and snippets.

@barryvdh
Last active January 8, 2020 19:40
Show Gist options
  • Save barryvdh/6696739 to your computer and use it in GitHub Desktop.
Save barryvdh/6696739 to your computer and use it in GitHub Desktop.
Symfony Security Checker in Laravel

Symfony Security Checker in Laravel

Artisan command for Sensiolabs Security Checker

Require this project in your composer.json file

"sensiolabs/security-checker": "2.x"

Add the following line to app/start/artisan.php:

Artisan::add(new SensioLabs\Security\Command\SecurityCheckerCommand(new SensioLabs\Security\SecurityChecker));

You can now run the security checker with artisan:

php artisan security:check

This defaults to the composer.lock file in your base dir, but you can add an extra argument with the full path to check

php artisan security:check /path/to/composer.lock

You can also output the result as json instead of text

php artisan security:check --format=json

[Official Documentation] https://github.com/sensiolabs/security-checker

@jlis
Copy link

jlis commented Sep 14, 2016

For the most recent Laravel version, the command should be registered in the app/Console/Kernel.php like this:

public function bootstrap()
{
    parent::bootstrap();
    $this->registerCommand(new \SensioLabs\Security\Command\SecurityCheckerCommand(new SecurityChecker()));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment