Is PHP a Rusty language?

We lived in quiet and peaceful times in the PHP community about 11 months ago, in late 2025. We didn't have agents yet, we managed projects manually and we had our favorite frameworks and tools we used for years.

Then this weird package came to my attention, on Reddit, something written in Rust. Looked like a replacement for PHPStan. I thought it was AI slop (as most projects were popular for a month and then disappeared), so I ignored it.

Then in spring 2026, agents came. Mago was still there.

Do you remember Mago 1.0?

I do, I looked for PHPStan vs Mago features, but could not find it. I wondered if there is some ~ 80 % rule parity, that would be a clear "hell yes!" to try it.

I didn't know Rust and thought it's a low-level language for hardcore devs and researchers or hardware folks. Suddently, it's parsing whole PHP codebase in 3 seconds!

The PHPStan ran about ~60 secodns, where Rust took few secs. How was that possible? They must be cheating or something. Some tools pretend to be blazing fast, then you find out they just use cache. That's like saying this car is the fastest car in the world... if you never drive it in the streets with traffic lights.

In about July 2026, Mago got my attention again. I was very skeptical about it - typical "if this were true, someone must have already written it years ago". But I thought the same about Rector for nearly half a year, before I put together the first public release.

Static Analysis on Legacy PHP under 10 secs?

My work is exclusively on legacy codebases, we always had PHPStan running 60-120 seconds. It was a pain to run it, fix anything and don't get me even started on custom rules. The levels were very rarely useful, as legacy projects suffer from mixed types everywhere. PHPStan doesn't run checks on mixed types until you're on a higher level, and we could not get to higher levels because we don't have any types. Ignoring errors was what got the project into this mess, so a baseline was not a way either. Chicken-egg problem.

All we needed was to spot non-existing methods (oh boy, so many missed), so we made custom rules like no mixed caller. This sole rule saved us from so many bugs, even before level 0.

This was hell to implement with tools like PHPStan, running on PHP 7.2-7.4, so looked into Mago. Unfortunately, it requires PHP 8.1 for some reason, so no-go.

Still, my intuition told me, there is a deep value in it... how could only 1 guy - azjezz - in the PHP community see it?

Welcome Foreign Languages

I looked into the Mago codebase, understood nothing. Looked like Java+PHP to me. The speed was still tempting enough to learn the language at least a bit. Dependencies, crates, how they're published. Apparently, nobody had even tried to parse PHP in Rust before. Mago was built way before agents came, so these guys must have invested hundreds of hours to make it work.

I wanted to make a prototype that would run on any PHP (5.6-8.5) and would solve one problem fast. Something none of these 2 can do or try to do. I was told I have to use full mago (or crate) to do this. It felt too costly, like using whole Symfony just to create a console command.

That's a no go. No other tool parsing PHP and alive in Rust. Hm...

Rust... or Go?

Then I had tiny serendipity chat with my new landlord that took under 3 mins but was about to change my life for next couple of years:

  • "I'm also developer."
  • "Oh, what you do?"
  • "PHP"
  • "How about you?"
  • "Go"

"Go"... is that even useful language for this usecase?

I briefly checked it, and found it very simple:

  • no methods,
  • no classes,
  • no public/private

It only has 25 keywords vs 71 of PHP. I can learn that!

Arguing with my past-me

Instantly searching for "php-parser go" I found someone had already written a parser 8 years ago. Under the post, there is my younger me arguing that it's better to use PHP for the same job. That aged fast.

To my surprise, the repository is still available: https://github.com/z7zmey/php-parser, in 2018 it was already 11x faster than php-parser.

I looked into learning Golang:

  • bought 2 paper books and read them before going to sleep for a couple of weeks,
  • read this amazing summary by the PHP dev behind Phpactor, where you get the syntax differences in clear short code snippets,
  • watched most of the conference videos
  • and even bought a ticket to GopherCon UK.

3 things that stood out:

  • made at Google in 2007, features can be delivered once 3 founding devs agree - no voting, no waiting, but no slop
  • it has Goroutines, something like parallel programming, out of the box - no extra package, no extra knowledge needed, just 2 keywords
  • the static analysis is in the language core - yes, there are no extra tools, no unit test runner, no PHPStan nor Rector - all of them are in the main binary

This language doesn't have a hype, there is a php-parser written in it. It has been in since 2018, it has few forks, a year ago one guy published another way of using go to parse PHP. Maybe, just maybe... it's a sign this language could be quite good to parse PHP.

Need for Speed

"So this language's faster than PHP, and what? Should we switch all our projects?"

No, faster language doesn't mean we have to rewrite all our code into it.


"So what is good for then?"

We can leverage the speed to greatly improve our developer and agentic experience.

How and when?

  • How did Mago improve static analysis in the past year?
  • How it accidentally made PHPStan 3x faster?
  • Can we have static analysis in Rust?
  • How about that Golang parser that is dead for past 6 years?
  • What can you do with the Golang parser yourself?

We'll look at these question and more in follow up part.


Happy coding!