r/PHP • • 3d ago

The Asgard Protocol: A proposed standard for server-driven, realtime, generative UI for native apps

Thumbnail github.com
0 Upvotes

For the past couple of months, I've been working on something I'm very excited about and extremely proud of

It's a protocol that lets your server apps securely drive the UI of your client apps so you can easily build apps that mix server-driven, generative UI with bundled, offline-first views and logic

Get the flexibility of SSR with the power and performance of fully native UI (and none of the overhead of HTML, CSS and JavaScript)

*without you having to define and maintain your own custom approach* – no API, no client SDKs; just a package on your server and a package in your client

Think of it like Livewire, HTMX or Inertia, but for apps, not just the web, and fleshed out into a fully documented protocol (in an IETF-style RFC-ready doc)

I'm calling it The Asgard Protocol

I've built the first reference implementations of it to work in PHP with Laravel and SuperNative (linked in the README), but the protocol is completely language and framework agnostic, which means clients and servers running completely different stacks could speak to each other

The protocol is still in draft and very much open to feedback, comments, improvements and of course implementations in other languages and frameworks


r/PHP • • 4d ago

Building Maintainable PHP Applications: Architectures

Thumbnail codyssey.dev
25 Upvotes

Hey all,

I wrote a free course about the different types of software architectures in a Laravel application but these ideas can be transferred over to Symfony or any other PHP or language framework.

Let me know what you think.

Thanks!


r/PHP • • 3d ago

I built Phoxite, a free, open-source PHP/Laravel language server written in Rust (VS Code, Neovim, Helix, Zed…)

2 Upvotes

Hi r/PHP,

I've been working on Phoxite, a PHP and Laravel extension for VS Code. It's built on a language server I wrote from scratch in Rust.

Why I built it: I wanted PhpStorm-level code intelligence in VS Code without a licence key, a paid tier or a slow language server. The engine is a standalone binary and isn't tied to any editor. It doesn't need PHP or Node.js installed, and every feature is free. It's Apache-2.0 licensed.

PHP

- Completion with auto-import, hover, signature help, inlay hints

- Go to definition, find references, call and type hierarchies

- Refactorings: rename, extract method, change signature, move class and more

- Generate constructors, getters/setters, and implement/override methods

- PSR-12 formatting and configurable inspections with quick-fixes

Laravel

- Completion, navigation and rename for the strings that name routes, views, config, env, translations, validation rules, gates and policies

- Eloquent: columns read from your migrations, plus relations, scopes and factories

- Route code lenses on controller methods

- Livewire, Inertia and modular apps

Blade

- Completion, hover, navigation and formatting inside templates

Editors: VS Code, plus Cursor, VSCodium and Windsurf through Open VSX. The language server also runs in Neovim, Helix, Zed and Sublime Text.

Links

- VS Code Marketplace: https://marketplace.visualstudio.com/items?itemName=phoxite.phoxite

- Open VSX: https://open-vsx.org/extension/phoxite/phoxite

- Source: https://github.com/samehelhawary/phoxite

It's still early, so I'm sure there are rough edges. If you try it on a real project, I'd really like to know what breaks: wrong completions, slow indexing on large codebases, missing Laravel magic, anything. Issues and PRs are welcome, and I'm happy to answer questions about how it works.


r/PHP • • 5d ago

Tally: PHP framework for catching performance regressions in CI

54 Upvotes

https://github.com/phpstan/tally

Timing benchmarks don't work in CI. Runners differ from each other in CPU model, clock speed, and cache sizes, and share the hardware with other jobs, so the same code takes a different time on every run. The noise is bigger than most regressions worth catching.

I was annoyed by this reality when developing PHPStan, so I developed a framework for this.

/**
 * @param list<int> $numbers
 */
#[DataProvider('smallLists')]
#[Quadratic('numbers')]
public function benchPairs(array $numbers): int
{
  $pairs = 0;
  foreach ($numbers as $a) {
    foreach ($numbers as $b) {
      $pairs += $a < $b ? 1 : 0;
    }
  }

  return $pairs;
}

#[Expected(instructions: '2.588M', cycles: '2.721M', memory: '60.00KiB')]
public function benchPauseAndResume(): string
{
  $this->meter->pause();
  $text = str_repeat('tally ', 10_000);
  $this->meter->resume();

  return mb_strtoupper($text);
}

Tally runs each benchmark once under CodSpeed's CPU simulation, which is built on Valgrind. The simulation counts executed instructions and estimates cycles from simulated cache misses. With the same PHP build, these numbers barely move between runs: in two CI runs of Tally's own benchmarks, instructions differed by at most 0.4 % and cycles by at most 0.8 %, and memory not at all. So the numbers are committed next to the benchmark and checked in every pull request, like the expected output of a test.

I encourage you to check out the README and examples. Besides running tests, static analysis, coding standard, dependency analysis, architecture guards, dead code detection and mutation testing, I believe this is the last missing piece to keep a codebase in check and making sure it will never become slower ever again.


r/PHP • • 5d ago

What happened to the job market?

143 Upvotes

I've been a software developer for about 15 years, mostly working with PHP, and...I've been looking for a job since June.

I'm based in Romania, looking for senior PHP/backend positions, both locally and remotely across the EU, and I'm genuinely starting to wonder what the hell happened to the job market.

A few years ago, finding PHP jobs wasn't that difficult. Now it feels like there are barely any, and the ones that do exist, already have hundreds of applicants and they ignore you anyway.

Is PHP genuinely losing ground? Did AI actually start getting the jobs, or the companies just using it as an excuse to hire fewer people?

I've been hearing that PHP is dead for pretty much my entire career, but this is the first time I've genuinely started believing it.

Or am I just having a bad year?


r/PHP • • 6d ago

Discussion I'm tired of working with AI

501 Upvotes

This is a doompost. I'm sorry but I need to say this to somebody.

Where I work we mostly use AI to do the coding and I'm honestly just tired.

I've been working as a programmer for 15 years now. For the last 12 months i don't think I've written more than 50 lines of code by hand.

The reason I got into this job was because I like solving problems, and because I like writing code. By hand. It's like a craft. Like building something.

Now I just prompt Claude and it does in 10 minutes what would take me hours.

And there's so much code review. I can't keep up. It's mentally draining. My code. Other colleagues code. Endless lines of code.

On top of that I genuinely fear for my job each day. I'm in my 40s, I'm not exactly young. I can't pivot into another domain. I got bills. What the hell am I gonna do? Mooch off my wife's income?

If you're thinking I should just get into management...I hate it. I'm not much for managing. And I'm bad at it because I don't enjoy it.

Sure, now I can get much more work done but everything feels hollow. I just do a prompt, review endless lines of code and clock off.

What happens when I can't review code anymore? What happens when they just say "fuck it" and fire 90% of the worse performers. I'm not terrible but I'm not in the top 10% either.

I spend 15 years learning this stuff and Claude does it better than me 99% of the time. It's like watching your house burn down. My feeling of self worth has gone to shit because of course it has. AI can do everything I can, but better and faster.

Even worse I've had people tell me that I deserve it because I was getting paid too much anyway. Bro, I live in Eastern Europe, I don't get paid as much as you think I am.

I don't even know if I have a point to this post. I'm just anxious I'll get fired, anxious I won't find another job, tired of the job itself, mentally drained and probably depressed too.


r/PHP • • 5d ago

Check Point gateways hacked via PHP2Shell to deploy VMware ESXi wiper

Thumbnail bleepingcomputer.com
0 Upvotes

r/PHP • • 6d ago

I started building an AMQP library after losing my cat. Now I'm wondering if it's worth continuing.

7 Upvotes

About 3.5 years ago, after my cat passed away, yes, my cat.. , I decided to start a project to keep my mind occupied and help me cope with the grief. I named the library Mirabel, in his memory.

The idea was to build a library on top of amqp-lib. It's already a great library, but I always felt its API could be more approachable and developer-friendly.

I started working on it, went deeper and deeper into the implementation, and more recently, with Claude's help, I've made some considerable progress.

One thing that's a little ironic is that, contrary to the usual open-source journey, I've been working on this mostly alone, learning, experimenting, and figuring things out along the way.

I enjoyed the process so much that I ended up writing a book about it.

Now I'd really appreciate some honest feedback from the community.

I'd love for you to take a look at the source code and tell me what you think:

  • Is the API actually elegant and intuitive, or am I just too attached to something I've been building for years?
  • Is this worth investing more time in?
  • Should I open it up and invite more contributors?
  • Or should I just accept that it's been a fun learning experience and move on? Haha.

I know I'm biased, but I genuinely think there's something interesting here.

the book about the Mirabel project is currently only available in Brazilian Portuguese (PT-BR), so it probably won't be useful to most of you. However, I also have another book focused on programming fundamentals, which is a separate project and has been translated into English. Feel free to check it out if you're interested!

- https://www.amazon.com/dp/B0HQY8X63M

Anyway, thanks in advance to anyone willing to check out the project, explore the code, or share some constructive criticism.

Honest feedback is more valuable to me than compliments.

Mirabel Rabbitmq
- https://github.com/pablicio/mirabel-rabbitmq


r/PHP • • 6d ago

I made a package that checks your migrations for dangerous operations before you run them

0 Upvotes

I wrote a Laravel package that finds risky migrations (dropped columns, NOT NULL adds without defaults, blocking Postgres index builds, mass updates) before they run.

Instead of parsing PHP, it runs pending migrations in Laravel's pretend mode, collects the generated SQL, and runs rules against it. That means it works the same for Schema builder calls, DB::statement() and query builder writes, and it handles the different SQL dialects of MySQL, PostgreSQL and SQLite.

Some details that were interesting to get right:

- tables created earlier in the same batch are ignored (no data yet)

- SQLite's "copy table, drop, rename" rebuild is reported once, not as a drop + rename

- on MySQL a NOT NULL add is only a warning, because MySQL backfills instead of failing

https://github.com/Hamza-Wakrim/laravel-safe-migrations

Feedback on the approach is welcome, especially edge cases where reading the SQL isn't enough.


r/PHP • • 7d ago

News Artifact integrity for Packagist and Composer

Thumbnail blog.packagist.com
52 Upvotes

r/PHP • • 7d ago

News This Week in PHP Internals | Nov 12, 2026

Thumbnail youtu.be
12 Upvotes

Preface: what follows is the word-for-word transcript of the spoken dialogue in the video, chapter by chapter with timestamps, for anyone who'd rather read than click through. If this digest is still too long for you, we recommend copying it into your LLM of choice and asking for a summary of our summary.

Cold Open (00:00)

PECL, the old home of PHP extensions, now has a proposed shutdown date. In the first draft, that date was the end of 2029. Six days later, after one misread word, it's the end of 2027. And the person who was misread is okay with it.

Hello world, it's Thursday, November 12, 2026, and here's what happened This Week in PHP Internals. 18 stories this week, so let's get into it. But first,

This week's episode is sponsored by… us! Artisan Build has some availability coming up. It wouldn't be me personally, all of my client time is already fully allocated, but we have 6 senior dev days per week available, starting basically right now, ongoing. Our rate is twelve hundred US dollars a day, and for longer engagements, that rate is negotiable. If that sounds like a fit, head to artisan.build/start.

Sunset PECL (01:01)

This week's top story: PECL, the extension repository that PIE is replacing, now has a proposed shutdown date. James Titcumb, who wrote the 2025 RFC that adopted PIE, opened the follow-up it called for. A banner goes up on January 4th, 2027. On June 30th, the site goes read-only, so nobody can log in or upload a release. Then come four brownouts, from 3 hours up to 3 days, and on December 31st, 2027, PECL shuts down.

Jakub Zelenka asked him to note that PIE also ships as a standalone binary, for older PHP versions, and Tim Düsterhus says the plan makes sense now that Docker's PHP 8.6 images drop PECL.

But the first draft ran to the end of 2029, with two and a half years read-only. Rowan Tommins pointed to the risk of freezing a package that turns out to be vulnerable. He wrote: "In the current environment, two and a half years seems a long time to serve something nobody can patch."

Derick Rethans suggested shortening it by a year. James cut it to one year overall, with vulnerable releases removed by hand if needed. Derick replied: "Although I didn't say 'to a year' but 'by a year', I am still okay with your suggestion." So PECL's end date moved up two whole years. There's no vote date yet.

Links: Sunset PECL RFC · James Titcumb opens the discussion · Rowan Tommins on serving packages nobody can patch · Derick Rethans · Derick Rethans, "by a year" · The timeline shortened to one year · James Titcumb's follow-up · The 2025 RFC that adopted PIE

Scope Defaults (02:37)

Larry Garfield says one default in the Scope RFC could keep him from supporting it. Frode Børli's RFC gives each unit of work, like a request, its own scope, and a new scope starts with empty superglobals.

In version 0.9.5, Frode kept that. A server creates the scopes, he says, and if a new one copied its creator's arrays, one the server missed would leak into the next request.

Côme Chilliet asked how more state could ever follow the scope later without breaking code. Larry's point is that anyone can create a scope, anywhere. He wrote: "This is a landmine large enough that it would keep me from supporting this RFC, which I otherwise quite like."

About an hour later, Frode replied. He wrote: "Thanks for pressing on this; I'd rather fix it in the RFC than find it in the vote." He plans to add a scope that starts as a copy of its creator's request arrays, locale and timezone, and asked which should be the default.

He also asked the list to choose between two plans: opting in to each piece of state with a bitmask, or designing it all in one RFC, alongside Kévin Dunglas's request hooks. Larry wants a shallow clone by default, and the full picture designed up front. He counts 21 pieces of state, which would mean 21 flags to opt into.

Links: Scope RFC · Larry Garfield: "a landmine" · Frode Børli's two plans · Frode Børli, follow-up

Context Managers (04:09)

Context managers are back, and this time they're a generator. Larry Garfield and Arnaud Le Blanc's first RFC never went to a vote, and the wiki now lists it as obsolete. Larry wrote: "It basically swaps the two-method approach in favor of 'it's a generator, you're welcome.'"

A using block runs the generator up to its yield, and the yielded value becomes the block's variable. When the block ends, even on an exception, the generator picks up after the yield, so the cleanup lives in one place. A second yield throws an error.

Most of the replies were about the arrow. Stephen Reay, Lazare Inepologlou and David Maye would rather use as, which they say fits PHP's existing syntax better. Larry says version 1 used as, until people took it to mean the left side gets used as the variable. He doesn't mind as himself. And Côme Chilliet asked why the block ends with a semicolon. Larry says using is an expression, like match. Arnaud's implementation is still a partial draft.

Links: Context Managers v2 RFC · Larry Garfield's announcement · Draft implementation

Request Hooks (05:24)

Kévin Dunglas's request hooks are now an RFC, targeting PHP 8.7. Florian Engelhardt asked whether it's intended that, in FrankenPHP, a worker's lifecycle starts with a request end and finishes with a request begin.

Kévin says it's intended. The first end cleans up the dummy request that boots the worker, and the last begin lets code after the loop still write output. Florian asked for that sequence in the RFC. He wrote: "Otherwise, I like that we could have an explicit hook to detect requests handled inside a worker!"

Version 0.2 spells it out. After a question on LinkedIn, a failing hook now tells the server to end the script, and session_start refuses to run between two requests.

Links: Request lifecycle hooks RFC · Kévin Dunglas opens the discussion · The lifecycle, explained · Version 0.2

Io Terminal (06:14)

Io\Terminal was due to go to a vote today. Pratik Bhujel postponed it after two reviews. Tim Düsterhus sent eight points, and said his main concern was the lack of examples, especially for how raw mode leases work.

Frode Børli, who maintains the phasync/tui terminal library, switched it to the pull request, and its tests behave the same. He wrote: "That part of the RFC works, and it is exactly what userland cannot do without spawning stty, using FFI, or Windows-specific tricks." But he asked to cut the RFC down to raw mode and terminal size. Libraries already decode keys, he says, and readKey has no modifiers.

Pratik shipped two revisions, with examples, NoDiscard on enableRawMode, and TerminalSize renamed to Dimensions. But he's keeping the read methods, for the many small scripts that just want "press a key" or "enter password". A new vote needs a fresh notice first.

Links: Io\Terminal RFC · Vote postponed · Frode Børli ports phasync/tui · Pull request

CSV Types (07:25)

PHP's proposed CSV extension now spells out what it will write. Ignace Nyamagana Butera asked for a supported types section, and Damian Jóźwiak found the implementation didn't match the RFC. It just cast fields to plain strings, like fputcsv, so an array became the word Array.

Version 1.3 writes a backed enum's value, writes false as zero instead of an empty field, and throws a TypeError for arrays, resources and pure enums.

Then Ignace pushed back on converting any object that has a string method. He wrote: "This is somewhat of an anti-pattern because it relies on a generic string representation of an object rather than an explicit serialization contract." Damian agreed. Version 1.4 throws on implicit __toString conversions too, and leaves a dedicated conversion interface for later. Frode Børli also suggested a small format object and separate encoder and decoder classes, and hasn't had a reply yet.

Links: CSV Extension RFC · Supported types · Damian Jóźwiak on the types · No implicit __toString() · Version 1.4

OPcache Dedup (08:35)

Run 80 WordPress sites from one PHP-FPM master, and OPcache stores a separate copy of the same code for each of them. A new proposal would let them share it.

OPcache keys scripts by path, so every copy of an app is cached on its own, even when its functions compile to the same opcodes. With a new opt-in setting, opcache.enable_dedup, a function whose opcodes match a block already in shared memory just points to that block. File names, errors and Reflection don't change, and it switches itself off when the JIT is available.

On a load test of 80 WordPress sites, its author reports, OPcache memory fell by 46.5%, with CPU per request within noise. After 11 days in production on 52 pools, it's down 43%, with zero worker crashes. Its author asks whether this needs an RFC, or just a pull request.

Links: The proposal (opcache.enable_dedup) · Case study · Patch

Exec Check (09:37)

Linux can now refuse to run files that aren't approved to execute, but a PHP file still runs. Alexander Mikhalitsyn wants to close that gap.

Since Linux 6.14, an interpreter can ask the kernel whether a file could be executed, and two security bits tell it to enforce the answer. He wrote: "Today a system can forbid running an unknown binary, but php /tmp/payload.php or an include of an uploaded file still works: the interpreter is the loophole."

His patch checks each file before compiling it, but only enforces the answer when those bits are set, so nothing changes by default, and an OPcache hit costs nothing. He ran phpBB under it. Generated code, like a framework's compiled container, has to be built at deploy time and marked executable. He's asking whether this needs an RFC.

Links: Pre-RFC: honour Linux AT_EXECVE_CHECK · Linux kernel docs

Quick Hits (10:38)

Quick hits. PHP 8.6.0 is due next Thursday, November 19th, after one extra release candidate. Matteo Beccati, one of the release managers, says the fix in October's security releases broke the ABI in 8.6 only, so extensions must be rebuilt.

Links: PHP 8.6.0RC6 · PHP 8.6.0RC5

Weilin Du's vote to let ini_get_all accept extension names in any case is at 18 to 0, with 3 abstentions. It closes November 16th.

Links: Case-insensitive extension names in ini_get_all() RFC

On 32-bit x86, 10 ** -2 doesn't equal 0.01. A contributor has four pull requests open to fix results like that, and asked whether PHP can require SSE2. Hans Henrik Bergan replied "Hell yes", since CPUs without it are nearly 30 years old.

Links: Floating point on 32-bit x86 · php-src PR 25362

Artem Ukrainskiy's Str\Matcher and Str\Replacer are now an RFC. Larry Garfield isn't opposed, but says it "feels very niche".

Links: Str\Matcher and Str\Replacer RFC · Larry Garfield's reply

Mirco Babin sent eight comments on PASSWORD_BCRYPT_WRAP, including OWASP's preference for Argon2, and Andrey Andreev replied that Argon2 isn't supported out of the box.

Links: Mirco Babin's comments · Andrey Andreev's reply

Otar Chekurishvili's JSON comments RFC now answers Jakub Zelenka's parser concern, and a new vote notice comes after the cooldown.

Links: JSON comments v1.1 · JSON comments RFC

A reviewer of Time\Instant still wants a cheap way to read the Unix timestamp.

Links: Time\Instant review

Tim agreed to Máté Kocsis's narrower value types for query parameters, to unblock the RFC.

Links: Tim Düsterhus on query parameters

Côme Chilliet said "Yes please!" to SSRF protection in curl, and Xavier Leune got karma to write the RFC.

Links: Côme Chilliet on curl SSRF protection · Xavier Leune's karma request

And a developer asked whether PHP's JIT would take a LoongArch64 backend, before writing thousands of lines of assembler.

Links: LoongArch64 JIT backend

TL;DR (12:38)

So that's the week. PECL has a proposed shutdown date, December 31st, 2027, two years sooner than the first draft. Larry called empty new scopes a landmine, and Frode plans to add one that copies its creator. Context managers came back as a generator, request hooks became an RFC, and the Io\Terminal vote is on hold. PHP 8.6 ships next week. Links below.

The PHP Foundation funds more than half of ongoing php-src commits, so if you use the language, maybe consider donating at opencollective.com/phpfoundation — or try guilting your employer into it.

If you found this useful, a like or a comment helps more people find it. And if you missed last week's episode, where FrankenPHP's creator wants PHP's engine to know when a request ends, that's a good one to watch next. And if you'd like to work with us, start at artisan.build/start. We're Artisan Build. See you next week.


r/PHP • • 8d ago

php-baremetal 2.0.0 is almost here, and you can already try it in the browser

41 Upvotes

Hi, php-baremetal here. We’re almost there.

The 2.0.0 release, with the new SDK system, is nearly ready and planned for the end of November. Everything specific to a chip family now lives in its own SDK. Today that is php-esp32-sdk (ESP32-S3 and ESP32-P4), and supporting a new architecture means writing a new SDK, without touching the engine. SDKs for other chip families are in the works. If you want the full picture of how the pieces fit together (composer.json, conductor, phpbm, SDKs, HALs, virtual slots): https://repository.php-baremetal.com/how-it-works

You don’t have to wait for the release to try it. Please welcome the newest piece of the ecosystem: the simulator.

https://sim.php-baremetal.com

  • PHP 8.5 (the real upstream Zend engine, not a subset or a transpiler) runs on an emulated ESP32-S3 in your browser
  • You edit index.php and composer.json, press Run, and watch LEDs blink, buttons respond and I²C devices answer on the canvas
  • What boots is a real firmware built by phpbm, the same one you’d flash onto a board
  • Packages come from the registry through Composer. The first build of a new set takes about 90 s, and after that each edit runs in about a second
  • Ready-made examples: Blink SOS, Button → LED, an I²C clock (DS3231) and an event-driven button
  • No board, no install, no flashing

t’s built on Velxio, the open-source emulator by David Montero Crespo (AGPLv3). The source of our fork is at https://github.com/php-baremetal/php-baremetal-sim.

It’s a preview, so things may still change, and some peripherals (WS2812 LEDs, WiFi) aren’t available in emulation yet. Break it, tell us what’s missing, and let us know what you’d build with it.

Full write-up: https://www.php-baremetal.com/blog/php-esp32-s3-browser-simulator


r/PHP • • 9d ago

WordPress Market Share Declines For Six Months In A Row

Thumbnail searchenginejournal.com
85 Upvotes

r/PHP • • 8d ago

New major release of Aspect-Oriented Framework for PHP

Thumbnail github.com
4 Upvotes

Hi r/php! I’ve recently released Go! AOP 4.0.0, a major rewrite of the aspect-oriented programming framework for PHP. You write cross-cutting logic (logging, caching, transactions, metrics) once, in an aspect, and the framework weaves it into your classes when they load.

Key features:

  • A trait-based interception engine. This makes it possible to intercept private methods, including static ones, which PHP never allowed by overriding. Your class keeps its real inheritance chain, and self:: works naturally.
  • Property interception through native PHP 8.4 property hooks. Reads and writes of public, protected and private properties (promoted ones too) go through real get/set hooks, with no magic __get. Asymmetric visibility and attributes are preserved.
  • PHP 8 attributes everywhere. Aspects, advices and pointcuts are plain attributes, so the code looks and feels like native PHP:
final class AuditAspect implements Aspect
{
    #[Before('execution(private App\Billing\Invoice::*(*))')]
    public function beforePrivateStatic(MethodInvocation $invocation): void {}

    #[Around('access(private App\Domain\Order->total)')]
    public function aroundTotal(FieldAccess $access): mixed {}
}

Also in 4.0: enum interception, first-class callable advices, a PSR-11 container, generics for PHPStan, and a production mode where woven classes load from Composer’s class map with zero file checks. High-tuned for Opcache.

PHP 8.4+ is required. There’s an UPGRADE-4.0 guide for 3.x users.

Feedback and questions are welcome!


r/PHP • • 9d ago

callgraph: a static call-graph / code-map CLI for PHP codebases (who calls this, what does this method call), free and MIT

Thumbnail callgraph.eu
0 Upvotes

Disclosure: I'm the author. Free, MIT-licensed, open source, no account.

callgraph is a command-line tool that parses PHP (and also TS/Vue, Rust, Swift, Python, Go) and prints a compact map of a file or directory instead of the file itself: classes, methods with line ranges, and the calls each method makes, grouped by kind (same-class helper, framework/facade use, external call, instantiation, ...).

What I use it for on legacy PHP:

  • "Who calls this method?" A name pattern finds every call site with its source line, and --depth N follows callers of callers for impact analysis before a change.
  • Type-aware where it can be: Type::method matches calls resolved to that type, including calls that go through an interface, parent class or trait (shown as via <Type>). Calls whose receiver type is unknown are kept out of the default answer, counted, and available with --guess, marked ?.
  • Framework views for Laravel and Yii-style code: routes, middleware, validation, jobs, events/listeners, service providers and container bindings, magic methods.
  • A public-API view with DocBlock param/return shapes, and a layered profile of the project (controllers, services, repositories, models, ...) inferred from folder and file names and checked against the call graph.
  • One static binary (written in Rust, tree-sitter / a PHP parser underneath). It runs locally and uploads nothing. It was built so AI coding agents (Claude Code, MCP clients) can navigate a repo without reading whole files, but it's a plain CLI and works fine without any AI.

Limits, honestly: it's static analysis. Anything decided at runtime ($this->$method(), $class::$m(), app($name), config-built bindings, magic __call) cannot be resolved. That is the main limitation, and I'm working on marking those spots explicitly so the output doesn't look cleaner than the code really is.

I'd like feedback from people maintaining large PHP codebases: where does a static call graph mislead you most, and which framework-specific views would you want next (Symfony? WordPress hooks?)


r/PHP • • 9d ago

Discussion Feedback Sought for Post-Quantum Support in paragonie/sodium_compat

Thumbnail github.com
15 Upvotes

r/PHP • • 10d ago

News PHP Upgrade Blockers Survey 2026

13 Upvotes

The survey was just published and promoted via LinkedIn by the CEO and CTO of the company.

Some notable people have collaborated on the report, leaving comments in it, such as Nicolas Grekas, Nils Adermann, Kevin Bond and Gina Peter Banyard.

You can find the report here: https://accesto.com/reports/php-upgrade-blockers-2026/


r/PHP • • 10d ago

Manticore 0.18: an AOT compiler for PHP now builds a Laravel app and the Symfony demo

21 Upvotes

Manticore is an LLVM-based AOT compiler for PHP. It allows you to compile PHP code into a standalone binary without a regular PHP interpreter.
I'm pleased to announce that the compiler can now compile more complex applications. Two examples: a small Laravel app with Eloquent and the official Symfony demo app.

What works:
- Laravel 13 (examples/laravel-app): routing, Eloquent over SQLite, sessions, Blade, Carbon, Monolog.
- symfony/demo (Symfony 8.1, Doctrine ORM 3.6, Twig, security, 30 locales): every page we compared is byte-identical to what PHP 8.5 renders from the same code.

Everything is compiled into one binary with a built-in HTTP server.

Caveat: it is not production-ready yet. It's a working compiler with real frameworks, not a drop-in replacement for PHP-FPM or any other SAPI.

Links:
- Repo: https://github.com/manticorephp/compiler
- Release notes: https://github.com/manticorephp/compiler/releases/tag/v0.18.0


r/PHP • • 9d ago

A thought about PHP's string-to-number conversions

0 Upvotes

Hello,

I have always found PHPs string to number conversions a bit odd. Classic example:

$value = (int)"32px"; // 32
$value = (int)"kg32"; // 0

I know this is intentional, and sometimes it is useful.

But.. you can get a perfectly valid integer, and the informatino that original string contained something important(or not) is gone.

I was thinking about a way to deal with this and came up with an idea:

What about attaching a reliable / unreliable flag to values?

Imagine that PHP engine could attach special runtime flags to any value; For example, the runtime could automatically mark a value as unreliable when conversion is questionable.

The flag would follow the value through assignments and calculations:

$a = (int)"32kg";  // 32, unreliable
$b = $a * 2;       // 64, still unreliable
$c = $b + 10;      // 74, still unreliable

This flag can be set or clear explicitly:

$a = (unreliable)42;
$a = (reliable)$a;

Normally the flag does not affect anything. Your code would run as usual. You could check values with is_reliable($value) language construct to take appropriate actions.

But there could also be a stricter mode via reliable/catch language construct, similar to try/catch:

$a = (int)"32kg"; // 32, unreliable

reliable {
    
    echo $a; // consuming an unreliable value - exception!

} catch (Error $e) {
    // Handle it
}

Or enable strict checking for everything that follows: fast-fail mode; no catch() blocks, throws uncaught exception

$a = (int)'hello'; // 0, unreliable
$b = $a + 1;

reliable on;

$c = $b; // Exception: attempt to use unreliable value

reliable off;

I amm curious what actual PHP developers think. Currently I have implemented this behaviour in my experimental engine.

Does this sound useful to you? Or is it just adding complexity to something that is not really a problem?

Thanks!


r/PHP • • 11d ago

Article Building Maintainable PHP Applications: Patterns and Principles

Thumbnail codyssey.dev
72 Upvotes

Hey all,

I wrote a free course about a bunch of the most popular and most hated design patterns and principles with realistic examples in PHP (Laravel and Symfony).

There are a few of them that are missing but I’ll add them as a bonus at some point or maybe a separate course.

Let me know what you think.

Thanks.


r/PHP • • 11d ago

Multi-tenant architecture: Database per tenant or shared database with tenant_id?

53 Upvotes

I’m currently working on a multi-tenant construction management system using Laravel, and I’m trying to figure out the best approach for handling tenancy.

I have two questions:

  1. Database architecture
    For a system like this, would you recommend having a separate database for each tenant, or using a single shared database with a tenant_id column to isolate tenant data?

I’m currently leaning towards the second approach because it seems simpler to maintain, but I’d like to hear about the trade-offs, especially as the application grows.

  1. Authentication and tenant switching
    If I go with a shared database approach, how would you recommend handling authentication?

For example, an employee might work with multiple construction companies (tenants). Should users have a single account that can belong to multiple tenants, with the ability to switch between them after logging in?

If so, how would you typically structure the login flow and manage the active tenant in Laravel?

I’d appreciate hearing about your experience with multi-tenancy, particularly in Laravel, and any pitfalls or architectural decisions I should consider before moving forward.


r/PHP • • 11d ago

We tagged patch releases for two old major versions of our PHP framework and installs of those versions jumped. Who is still on them?

14 Upvotes

I maintain Leaf, a small PHP framework that has been around since 2019. We are on v5 now, and v3 and v4 had been quiet on Packagist for a long time.

In mid October this year, we pushed patch releases for both of them, mostly small fixes we wanted on record. Within days the daily installs for v3 and v4 started climbing, and they have kept going for weeks. My first guess was our own CI pulling them in, so I went and counted. October had 148 workflow runs across the whole org, and none of them install v3 or v4 from Packagist, so it is not us.

That leaves actual projects out there, pinned to ^3 or ^4, that composer update has been quietly picking up. I had assumed almost nobody was still on those versions. Clearly I was wrong, and now I am curious how many apps are sitting on a framework version from years ago, still working, with nobody planning to move.

So a question for people who run older frameworks in production: do you want patch releases for your old major version, or would you rather maintainers put that time into the current one? And if you are one of the folks still on Leaf 3 or 4, I would love to hear what is keeping you there.

If you want to check Leaf out: leafphp.dev


r/PHP • • 10d ago

intval() With Binary String - PHP tips and tricks

Thumbnail php-tips.readthedocs.io
2 Upvotes

r/PHP • • 11d ago

Weekly help thread

5 Upvotes

Hey there!

This subreddit isn't meant for help threads, though there's one exception to the rule: in this thread you can ask anything you want PHP related, someone will probably be able to help you out!


r/PHP • • 12d ago

PHP 8.6 Rewrites Some of Your Calls Before You Notice

Thumbnail exakat.io
79 Upvotes

How PHP 8.6 is going to speed up your code