sr57's avatar
Level 39

Laravel sanitary check?

Hi all,

Any tools to do some sanitary checks in Laravel?

Like not updating db in migration ( see this post https://laracasts.com/discuss/channels/eloquent/shange-default-values-selectively?page=1#reply=679581 )

0 likes
2 replies
mabdullahsari's avatar
Level 16

TLint for enforcing a particular "Laravel-style" https://github.com/tighten/tlint

PHP CS Fixer to enforce consistent code style and PSR-12 (+ extensions, such as Symfony's) https://github.com/FriendsOfPHP/PHP-CS-Fixer

Larastan to eliminate silly bugs https://github.com/nunomaduro/larastan

You can set up Git pre-commit hooks to automatically run php-cs-fixer for example. That way, it is always consistent. You can use GrumPHP for this, but I personally use husky & lint-staged.

TLint does not support passing multiple files through its CLI, so I'm probably going to submit a PR to support that (tools like lint-staged depend on that). If you have a CI environment, it is best to also run Larastan in your pipeline.

Please or to participate in this conversation.