Laravel code-quality tools

This page summarizes the projects mentioned and recommended in the original post on

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • food-order-app-laravel-tdd

    A sample project for demonstrating the basics of test-driven development in Laravel

    git clone cd food-order-app-laravel-tdd git checkout tdd

  • PHP-CS-Fixer

    Discontinued A tool to automatically fix PHP Coding Standards issues [Moved to:] (by FriendsOfPHP)

    If you don't want to use any of those presets, your only option is to specify the all the rules by hand. Pint is built on top of PHP CS Fixer so you can use all the rules that it has. You can use the PHP-CS-Fixer configurator to cherry-pick your own set of rules.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

  • enlightn

    Your performance & security consultant, an artisan command away.

    Enlightn scans your code to check whether it follows best practices in performance, security, and reliability. It's a paid tool, but it also has free checks you can use. At the time of writing, it has 64 checks in the free version and 128 checks in the paid version. For the purposes of this article, we'll only be using the free version.

  • PHP Code Sniffer

    PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.

    PHP Insights supports sniffs from PHP CodeSniffer and fixers from PHP CS Fixer. This allows you to add any sniff or fixer as long as it implements PHP_CodeSniffer\Sniffs\Sniff or PhpCsFixer\Fixer\FixerInterface.

  • Psalm

    A static analysis tool for finding errors in PHP applications

    Psalm is a static analysis tool for PHP. Much like PHPStan is to Larastan, Psalm has a plugin called Laravel Psalm that allows you to easily use it in Laravel projects.

  • coding-standard

    Slevomat Coding Standard for PHP_CodeSniffer provides many useful sniffs

    If you go through the imports in the config/insights.php file, you'll see that it mostly uses rules from NunoMaduro\PhpInsights and SlevomatCodingStandard\Sniffs. The former is PHP Insight's in-house insights and the latter is the sniffs from the Slevomat coding standard. In most cases, you'll only ever reach for those two.

  • PHPStan

    PHP Static Analysis Tool - discover bugs in your code without running it!

    PHPStan is a static analysis tool for PHP. Larastan is a package built on top of PHPStan to make it easier to integrate with Laravel projects. PHPStan works by "sniffing" the code using the various rulesets applied to it and determine if it follows the standards. However, Larastan doesn't fully follow the definition of "static analysis" since it has to boot the application's container and resolve the types that can only be computed at runtime. This is why Larastan is called a "code analysis" tool rather than a "static analysis" tool.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • larastan

    Discontinued ⚗️ Adds code analysis to Laravel improving developer productivity and code quality. [Moved to:] (by nunomaduro)

    In addition to the checks that PHPStan provides, Larastan has checks specific to Laravel. You can check out the rules doc for that.

  • psalm-plugin-laravel

    A Psalm plugin for Laravel

    Psalm is a static analysis tool for PHP. Much like PHPStan is to Larastan, Psalm has a plugin called Laravel Psalm that allows you to easily use it in Laravel projects.

  • phpinsights

    🔰 Instant PHP quality checks from your console

    PHP Insights is a code quality analysis tool that checks for code quality, coding style, complexity, and architecture. Just like Pint, it's also opinionated, so you'll have to customize it to fit your needs.

  • ale

    Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support

    Support for code quality tools are provided by the ALE plugin. These are supported for PHP:

  • sublime-phpcs

    🔍 PHP CodeSniffer, PHP Coding Standard Fixer, Linter, and Mess Detector Support for Sublime Text

    Sublime-phpcs - adds support for PHP_CodeSniffer, PHP Code Beautifier, PHP CS Fixer, PHP Linter, and PHP Mess Detector.

  • starter-workflows

    Accelerating new GitHub Actions workflows

    The real power of using PHP code-quality tools is when it’s added to your continuous integration process, which means it automatically checks the code every time someone makes a push or pull request to your project repo. In this section, we'll be looking at how to do just that. GitHub actions is available for free so we'll use it for demo purposes. Note that there are some limits to private repos, so set your test repo to public if you can.

  • LSP

    Client implementation of the Language Server Protocol for Sublime Text

    Psalm - support for Psalm can be added via the LSP plugin. More information about it can be found in Psalm's documentation.

  • laravel-pint-action

    GitHub Action for Laravel Pint

    Here's the workflow for Laravel Pint. In this case, we're using a ready-made action. Since Laravel Pint is so simple, we can get away with using something like this. Instead of run, you supply the name of the action. You can find these on GitHub Marketplace or simply search for "[name of code quality tool] github action" on Google:

  • In the above workflow, we used the --report option and that requires us to have the ENLIGHTN_USERNAME and ENLIGHTN_API_TOKEN in our environment variables. Since we can't directly add them to our .env file for security reasons, we need to use Actions Secrets. You can add secrets on this page: Click on the New repository secret button to add your secret:

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts