{"slug": "rust-go-leverage-in-php", "title": "Rust/Go Leverage in PHP", "summary": "Mago 1.0, released in December 2025, runs static analysis roughly 50x faster than the fastest competing PHP analyzer, prompting PHPStan to speed up 3x during 2026, with PHPStan 2.3 documented by Ondra as a leap in performance from December 2025 to October 2026. PHPStan users on PHP 7.4+ are advised to update to version 2.3, while Mago's own speed was cut in half in the week before the post, according to a post by Mago creator azjezz. Tomas Votruba published an open-source benchmark repository, Need for Speed, that runs in GitHub Actions CI across multiple PHP versions and tools he does not own, and he argues PHP developers no longer need to know Rust or Go to build on tools like Mago's PHP-parsing crate by using agents.", "body_md": "# Rust/Go Leverage in PHP\n\nIn the previous post we looked at how Rust's speed of static analysis opened the door for non-PHP languages to analyze PHP codebases.\n\nWhat influence did it bring upon the PHP world? How can we - PHP devs - leverage it for our own profit?\n\n## Mago made PHPStan faster\n\nMago 1.0 was released in December 2025. Until then, speed was not a priority for static analyzers. Correctness was: how accurate the analysis is and how much broken code it can spot in CI. Mago changed this. Well, seeing a project run **50x faster than the fastest monopoly on the market** does that.\n\nWe love healthy competition, the same way we're happy to see Anthropic and OpenAI compete for our subscriptions with lower prices.\n\nPHPStan jumped on the train, put agents to work and managed to speed up **3x in 2026 alone**. I didn't have any real numbers, apart from a few tweets here and there, but Ondra [wrote a blog post about the speed-up improvements](https://phpstan.org/blog/phpstan-2-3-leap-in-performance) from December 2025 until October 2026.\n\nYou may say \"from 60 s to 20 s is still no match for Mago's 2 s\", and you'd be right.\n\nBut instead of absolute data, let's focus on the vector direction. Mago was fast from the start and cannot run much faster (there is no need to; 1-2 s is not a weak spot). PHPStan, on the other hand, was always blocking CI pipelines, requiring splitting into multiple directories and skip paths. Not anymore. **If you use PHPStan on PHP 7.4+, update to version 2.3 and profit**.\n\n## Independent Benchmarks\n\nOn a side note, can we trust these benchmarks? We've seen way too many of them thanks to agentic scoring, where somehow the author's tool is always the winner.\n\n\"I don't trust benchmarks I haven't forged myself\"\n\nLocally, with 24 or 32 cores, most results are somewhat fast. Though 30-120 seconds is still a pain to sit through for us, and especially for agents. The CI is the blocker, along with laptops with 4-8 cores. Yes, not everyone in the world has the latest Macbook M5. So to be sure we see real numbers, I made a small open-source repository:\n\n- the benchmark runs in GitHub Actions CI - a reproducible environment with a capped CPU count\n- it runs on various PHP versions, like the real world\n- it runs various tools I don't own\n- anyone can contribute\n\nIt also has a CI check that makes sure the latest version is benchmarked. This avoids the \"old version is slow\" fallacy we often see with static blog posts.\n\n**Check it here**: [Need for Speed](https://github.com/tomasVotruba/need-for-speed)\n\n*Screenshot from today.*\n\nThe game is on! Mago's speed was just [cut in half in the past week](https://x.com/azjezz/status/2109260261425127560).\nThis is only the beginning. By the end of 2026, we'll see PHPStan running 2x faster than today.\n\n## \"I don't know any Rust nor Go\"\n\n\"This is all nice, Tomas, but not for me. I'm only a passive end-user of these tools. Install, run it and forget. How is this useful in a deeper way?\"\n\nIf that's the case, I'm with you. I had this view in July 2026, when I was envious of people who knew Rust - that they could look into Mago, improve it, or build their own tiny tool doing something similar. Like we do with `php-parser` when we need to get the job done fast.\n\nBut...! We don't need to *know* the language anymore.\n\n## Zero + agents = Hero\n\nIf you're a fan of Rust but never wrote a line, give it a go. Mago has a crate for PHP parsing (something like a monorepo split package) that you can use. Me, I want to experiment fast without depending on someone else's speed. Also, I kinda fell in love with *Go*'s simple syntax and philosophy.\n\nHere is my experience: after learning a bit of Go syntax and philosophy this summer, I gave agentic development a Go (pun intended):\n\n- Command line,\n- parse file,\n- change return type declaration to array,\n- and print the file back.\n\nIn [the last post](https://tomasvotruba.com/blog/is-php-a-rusty-language), we looked at [z7zmey/php-parser](https://github.com/z7zmey/php-parser) - a PHP parser written in 2018, but abandoned in 2020. It could not parse PHP 8 and was not maintained.\n\nCould agents help?\n\n- \"Hey, take this repository and add PHP 8.0-8.5 compatibility, test it, allow parsing of any PHP on the input.\"\n\nI didn't want to embarrass myself by publishing crappy slop, so I made the fork private. First I wanted to **run it on a real project** - legacy, with PHP 5.6 or 7.2, where neither PHPStan nor Rector can run - and **see real results merged and shipped**. Proof over hype.\n\n## Real Results on Real Projects\n\nAnyone can run a tool fast on this or that slim open-source project. Open-source projects are tiny, specialized and typically run on the latest PHP. The total opposite of any private PHP project I've seen (or made). E.g. Laravel 13 has around 270 000 LOC.\n\nA typical private project is:\n\n- at least 500 000 LOC\n- not on the latest modern PHP\n- not made in the past 5 years by a team of well-funded senior developers\n\nI gave it a go and... it worked! Where Rector would have to run in Docker for 20+ mins, or with features frozen in a 2020 version, I could now run any *Reco* (code name) rule in a couple of seconds.\n\nTo be clear, **under 1 second**.\n\n**How about Rust?** I still wasn't sure whether to double down on Golang, so I implemented a similar task in Rust. After all, if Go were ~10 seconds and Rust ~1 s on a legacy project, Rust would be the clear winner.\n\nTo my surprise, both were under 1 s. When speed is the same, simplicity wins.\n\n## Under 1s Club\n\nThis is a new baseline. With speed like this on a whole (legacy!) codebase, you can just do stuff.\n\nLike run 100 rules: 1 rule changes = 1 commit. 20 commits...? = 20 seconds.\n\nI always wanted one feature to @rectorphp, but it would take ~15+ mins on most projects. It would save sooo much time with \"git commit\" and files picking.\n\nWhat is the feature?\n\nRun 1 rule separately. If it changes anything? Commit.\n\nGoto next rule.\nRun all rules this way [https://t.co/3vsrnS7gH9](https://t.co/3vsrnS7gH9)\n\n[August 13, 2026](https://x.com/VotrubaT/status/2087910339266347314?ref_src=twsrc%5Etfw)\n\n## Just Build Things\n\nIt's been 3 months and *Reco* has over 100 rules now. *Reco* is still exclusive to my clients, but you can take the Mago crate and make the tool you want to see run really fast.\n\nIf you prefer Go, I made the improved fork available as [PHP Parser in Go](https://github.com/tomasVotruba/php-parser-in-go). Full PHP 5, 7 and 8 support, no requirements. Runs on any code, use at your own risk.\n\nI'm walking the talk: building a static analysis tool and... a coding standard tool.\n\nWhy is Go/Rust tooling useful when it comes to dependencies? Why do agents prefer it to PHP tooling? What to be aware of when rewriting a PHP tool to Go/Rust? You'll see in the next post.\n\nHappy coding!", "url": "https://wpnews.pro/news/rust-go-leverage-in-php", "canonical_source": "https://tomasvotruba.com/blog/rust-go-leverage-in-php", "published_at": "2026-10-15 00:00:00+00:00", "updated_at": "2026-11-05 13:19:15.440917+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents"], "entities": ["Mago", "PHPStan", "Ondra", "Tomas Votruba", "Need for Speed", "azjezz", "z7zmey/php-parser", "Go"], "also_reported_by": [], "takeaway": "PHPStan 2.3 delivers a 3x speed-up over its December 2025 version, narrowing the gap to Mago's roughly 50x-faster analysis, so PHP 7.4+ projects should upgrade to 2.3 to cut CI times.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/rust-go-leverage-in-php", "markdown": "https://wpnews.pro/news/rust-go-leverage-in-php.md", "text": "https://wpnews.pro/news/rust-go-leverage-in-php.txt", "jsonld": "https://wpnews.pro/news/rust-go-leverage-in-php.jsonld"}}