PHP Static Analysis

Open-source PHP projects categorized as Static Analysis | Edit details

Top 23 PHP Static Analysis Projects

  • GitHub repo PHP Parser

    A PHP parser written in PHP

    Project mention: Tree-sitter: an incremental parsing system for programming tools | news.ycombinator.com | 2021-02-22

    I wish there was a more universal format for parsers, but I just don't think there enough people who know their stuff.

    Take PHP, a language that a lot of people use: the tree-sitter-php extension doesn't support features added in 2019, let alone features added towards the end of 2020.

    If you want an up-to-date PHP parser, there's really only one open-source parser[0] that's accurate enough to be used on PHP codebases old and new, and it's written in PHP. Then if you want to parse in a robust fashion you have to adopt a number of hacks to get everything working.

    I hadn't encountered LSIF before – can GitHub be configured to use those maps?

    [0] https://github.com/nikic/PHP-Parser

  • GitHub repo PHP CS Fixer

    A tool to automatically fix PHP Coding Standards issues

    Project mention: Let's say you get an old, PHP5, mysql_*, horrible codebase, riddled with security issues and no composer. Your task is to make it work on PHP7+. | reddit.com/r/PHP | 2021-08-29

    once these are done, composer require php codestyle fixer.

  • Scout APM

    Scout APM: A developer's best friend. Try free for 14-days. Scout APM uses tracing logic that ties bottlenecks to source code so you know the exact line of code causing performance issues and can get back to building a great product faster.

  • GitHub repo PHPStan

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

    Project mention: PHP-backend Roadmap | dev.to | 2021-09-11

    But the quality of the code and its style may seem subjective things, but teamwork requires it really often. In the PSR-12 standard, you can find the list of recommendations on how to style it. That standard isn't the only existing one, but it's definitely the most common. To simplify following it you can use CodeSniffer. And in order to develop the habit of writing clean code, you can use Psalm, Phan, or PHPStan linters. There's no need to learn each – better to choose the one you like most. In my case it's Psalm.

  • GitHub repo PHP Code Sniffer

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

    Project mention: PHP-backend Roadmap | dev.to | 2021-09-11

    But the quality of the code and its style may seem subjective things, but teamwork requires it really often. In the PSR-12 standard, you can find the list of recommendations on how to style it. That standard isn't the only existing one, but it's definitely the most common. To simplify following it you can use CodeSniffer. And in order to develop the habit of writing clean code, you can use Psalm, Phan, or PHPStan linters. There's no need to learn each – better to choose the one you like most. In my case it's Psalm.

  • GitHub repo phan

    Phan is a static analyzer for PHP. Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness.

    Project mention: Emotional Rage: any static-typed PHP compilers? | reddit.com/r/PHPhelp | 2021-07-15

    You can use a static analyzer like Phan to lint the project.

  • GitHub repo Psalm

    A static analysis tool for finding errors in PHP applications

    Project mention: PHP-backend Roadmap | dev.to | 2021-09-11

    But the quality of the code and its style may seem subjective things, but teamwork requires it really often. In the PSR-12 standard, you can find the list of recommendations on how to style it. That standard isn't the only existing one, but it's definitely the most common. To simplify following it you can use CodeSniffer. And in order to develop the habit of writing clean code, you can use Psalm, Phan, or PHPStan linters. There's no need to learn each – better to choose the one you like most. In my case it's Psalm.

  • GitHub repo larastan

    ⚗️ Adds static analysis to Laravel improving developer productivity and code quality.

    Project mention: Matt Brown, the creator of psalm, stops working at Vimeo (and stops working with PHP) | reddit.com/r/PHP | 2021-06-29

    https://github.com/nunomaduro/larastan should help with this specifically

  • Nanos

    Run Linux Software Faster and Safer than Linux with Unikernels.

  • GitHub repo PHP Mess Detector

    PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly frontend application for the raw metrics stream measured by PHP Depend.

    Project mention: Twelve-factor app módszer a gyakorlatban / 1. rész | dev.to | 2021-08-22
  • GitHub repo Deptrac

    Keep your architecture clean.

    Project mention: Tool for analysis dependency inside your project | reddit.com/r/PHP | 2021-08-11

    It looks very similar to these mature projects: - https://github.com/qossmic/deptrac - https://github.com/j6s/phparch

  • GitHub repo PHPCompatibility

    PHP Compatibility check for PHP_CodeSniffer

    Project mention: Let's say you get an old, PHP5, mysql_*, horrible codebase, riddled with security issues and no composer. Your task is to make it work on PHP7+. | reddit.com/r/PHP | 2021-08-29

    also, PHPCompatibility https://github.com/PHPCompatibility/PHPCompatibility is a phpcs ruleset to detect deprecated/removed stuff.

  • GitHub repo php-language-server

    PHP Implementation of the VS Code Language Server Protocol 🆚↔🖥

    Project mention: How to use (and contribute) to neovim's built-in language server client and nvim-lspconfig | reddit.com/r/neovim | 2021-01-07

    but as many people working in a lot of things I have no time to try to configure https://github.com/felixfbecker/php-language-server with nvim-lsp

  • GitHub repo PHP Architecture Tester

    PHP Architecture Tester - Easy to use architectural testing tool for PHP :heavy_check_mark:

    Project mention: arkitect VS PHP Architecture Tester - a user suggested alternative | libhunt.com/r/arkitect | 2021-09-16

    Easy to use architecture testing tool for PHP

  • GitHub repo enlightn

    Your performance & security consultant, an artisan command away.

    Project mention: Your automated performance/security consultant for Laravel apps! | reddit.com/r/PHP | 2021-01-22

    Uhh did you check the link? It's another product. The security checker is an independent package. The Enlightn Github repo is here and the security checker is here. Lol you were so busy criticizing about emojis, you don't even know what I was talking about.

  • GitHub repo BackwardCompatibilityCheck

    :ab: Tool to compare two revisions of a class API to check for BC breaks

    Project mention: PHP 8.1 is getting Enums, and here is an article about Enums in depth | reddit.com/r/PHP | 2021-02-19

    btw when I talk about breaking BC I don't really mean not compatible with something stored in the DB using a previous version of the code. I mean not compatible with other PHP code written to work with a previous version of the code. It's the sort of issue https://github.com/Roave/BackwardCompatibilityCheck exists to detect, and for which semver says you have to increase the major version number on a library.

  • GitHub repo unused-scanner

    Detect unused composer dependencies

    Project mention: Unused Scanner 2.3 released | dev.to | 2021-04-15

    Now distributes as phar archive also! You can download phar from the releases page

  • GitHub repo Exakat

    The Exakat Engine : smart static analysis for PHP

  • GitHub repo psalm-plugin-laravel

    A Psalm plugin for Laravel

    Project mention: [Poll] Do you use preloading in your applications? | reddit.com/r/PHP | 2021-07-04

    Also disagree with the static analysis take - we have dozens of Laravel applications that pass Psalm's static analysis with the strictest settings. All it takes is the Laravel plugin and some DocBlocks here and there.

  • GitHub repo phpstan-deprecation-rules

    PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.

    Project mention: What is the easiest way to migrate from 3.5.6 to 4.2? | reddit.com/r/cakephp | 2021-04-29

    yes what i do is copy the structure of the app and then use phpstan with deprecation rules to fix the most common deprecations.

  • GitHub repo functional

    PHP Functional Programming library. Monads, common use functions and generic collections.

    Project mention: Psalm friendly generators based Streams | reddit.com/r/PHP | 2021-09-17

    Hello. I've added Psalm friendly generators based Stream support in my lib. It can be useful if you care for memory usage.

  • GitHub repo phpstan-wordpress

    WordPress extensions for PHPStan ⛏️

    Project mention: Introducing GraphQL by PoP, a CMS-agnostic GraphQL server in PHP | reddit.com/r/PHP | 2021-01-22

    So I have set-up PHPStan on all agnostic packages, aiming to level 8 (I'm not there yet). And with the WordPress packages I also run PHPStan (thanks to szepeviktor/phpstan-wordpress), being able to focus on WordPress code only.

  • GitHub repo phpstan-drupal

    Extension for PHPStan to allow analysis of Drupal code.

    Project mention: A minimal Drupal 9 local development environment | dev.to | 2021-02-28

    PHPStan for Drupal

  • GitHub repo wordpress-stubs

    Up-to-date WordPress function and class declaration stubs for static analysis by PHPStan

    Project mention: 🍾 GraphQL API for WordPress is now scoped, thanks to PHP-Scoper! | dev.to | 2021-03-31

    return [ 'patchers' => [ function ( $file_path, $prefix, $contents ) { /* * There is currently no easy way to simply whitelist all global WordPress functions. * * This list here is a manual attempt after scanning through the AMP plugin, which means * it needs to be maintained and kept in sync with any changes to the dependency. * * As long as there's no built-in solution in PHP-Scoper for this, an alternative could be * to generate a list based on php-stubs/wordpress-stubs. devowlio/wp-react-starter/ seems * to be doing just this successfully. * * @see https://github.com/humbug/php-scoper/issues/303 * @see https://github.com/php-stubs/wordpress-stubs * @see https://github.com/devowlio/wp-react-starter/ */ $contents = str_replace( "\\$prefix\\_doing_it_wrong", '\\_doing_it_wrong', $contents ); $contents = str_replace( "\\$prefix\\__", '\\__', $contents ); $contents = str_replace( "\\$prefix\\esc_html_e", '\\esc_html_e', $contents ); $contents = str_replace( "\\$prefix\\esc_html", '\\esc_html', $contents ); $contents = str_replace( "\\$prefix\\esc_attr", '\\esc_attr', $contents ); $contents = str_replace( "\\$prefix\\esc_url", '\\esc_url', $contents ); $contents = str_replace( "\\$prefix\\do_action", '\\do_action', $contents ); // ... } ] ]

  • GitHub repo php-dependency-analysis

    Library for check dependency between modules inside projects

    Project mention: Tool for analysis dependency inside your project | reddit.com/r/PHP | 2021-08-11
NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020). The latest post mention was on 2021-09-17.

Index

What are some of the best open-source Static Analysis projects in PHP? This list will help you:

Project Stars
1 PHP Parser 14,821
2 PHP CS Fixer 10,480
3 PHPStan 10,177
4 PHP Code Sniffer 8,809
5 phan 5,139
6 Psalm 4,353
7 larastan 3,025
8 PHP Mess Detector 1,948
9 Deptrac 1,697
10 PHPCompatibility 1,638
11 php-language-server 1,049
12 PHP Architecture Tester 568
13 enlightn 532
14 BackwardCompatibilityCheck 460
15 unused-scanner 390
16 Exakat 361
17 psalm-plugin-laravel 190
18 phpstan-deprecation-rules 182
19 functional 123
20 phpstan-wordpress 115
21 phpstan-drupal 108
22 wordpress-stubs 73
23 php-dependency-analysis 9
Find remote jobs at our new job board 99remotejobs.com. There are 24 new remote jobs listed recently.
Are you hiring? Post a new remote job listing for free.
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com