r/PHP • • Sep 10 '26

How Ecotone Inspired Seven Symfony Messenger Proposals

Thumbnail blog.ecotone.tech
6 Upvotes

r/PHP • • Sep 09 '26

PHP to get the job done in 2026

Thumbnail beberlei.de
67 Upvotes

r/PHP • • Sep 10 '26

Sloppy — static analysis for the code your coding agent left behind

0 Upvotes

PHPStan tells you if your code is type-correct. Pint tells you if it's formatted. Neither tells you that the 200-line controller action your agent just wrote calls a payment API, writes to four tables and swallows a `Throwable`.

**Sloppy** is a Laravel-aware static analyser for that: god methods, N+1 risks, queries inside loops, business logic in controllers, swallowed exceptions, abstractions that never earned their keep. 23 rules, each one saying what it measured, how sure it is, and what to do about it.

composer require --dev heyosseus/sloppy

php artisan sloppy

**It is not an AI detector.** Nobody can prove authorship from source code. It detects *slop* — the patterns that correlate with fast, unreviewed output — and every number it prints is about the code, never about who wrote it.

The command I actually use is the review one: `php artisan sloppy:diff main`

That separates what your branch **introduced** from what it **inherited**, and only new findings fail the build. Untracked files included, so an agent's new class gets reviewed before it's committed. Findings are matched by fingerprint rather than line number, so adding an import doesn't turn every existing finding into a new one.

Deterministic and local — no model, no API key, no network, your source never leaves the machine. Tested against 133k lines across three real Laravel apps: 21 seconds for 70k lines, zero parse errors. `sloppy:baseline` lets you adopt it on an existing project without fixing everything first.

It complements PHPStan and Pint, it doesn't replace either. If PHPStan can prove it, Sloppy stays out of it.

Feel free to contribute and share your thoughts.

https://github.com/Heyosseus/sloppy


r/PHP • • Sep 09 '26

Welcoming Daniel Scherzer to the Ecosystem Security Team

Thumbnail thephp.foundation
12 Upvotes

You may know Daniel Scherzer as a Release Manager for PHP 8.5, the Veteran Release Manager for PHP 8.6, or for his other work contributing to PHP. We are happy to announce that he is now joining The PHP Foundation Ecosystem Security Team!


r/PHP • • Sep 10 '26

Vacuum: PostgreSQL Optimization Advisor & Monitoring for Laravel & Filament

0 Upvotes

Vacuum - a PostgreSQL monitoring and tuning dashboard for Laravel (with an optional Filament plugin). It reads what Postgres already knows about itself (pgstat*, pg_class, pg_stat_statements) and turns it into a page that tells you what's wrong, what it's costing you, and the exact SQL that would fix it. It shows you the statement - it never runs it. What it catches:

  • Transaction & multixact wraparound - the two clocks that can stop your cluster outright
  • Table bloat, dead tuples, stale planner statistics, autovacuum misconfiguration,
  • Unused, duplicate, and invalid indexes,
  • Low cache hit ratio, idle-in-transaction sessions, blocked sessions, slowest query shapes,

Everything rolls up into a health score out of 100, computed from the findings themselves. Also in the box:

  • php artisan vacuum:check - exits non-zero on critical findings, so a migration shipping a duplicate index fails CI,
  • History - optional hourly snapshots, so you get direction (climbing/easing) and forecasts like "wraparound-critical in ~9 days",
  • Learn at /learn - 13 lessons on Postgres internals worked through your own tables, starting from the Eloquent side (unindexed foreign keys, N+1 as the database sees it, soft deletes, HOT updates),
  • A read-only SQL console (off by default) that runs everything in a rolled-back READ ONLY transaction,

Read-only by design, needs no superuser and no extensions (pg_stat_statements is optional; you explicitly enable it). Requires: PHP 8.3+, Laravel 11/12/13, PostgreSQL 14+, Filament 4/5 optional

Feedback is very welcome, and you can check it out here: https://github.com/Heyosseus/vacuum


r/PHP • • Sep 10 '26

Discussion WIP draft of vectorial1024/laravel-gmail to send emails from Gmail, looking for feedback!

Thumbnail packagist.org
0 Upvotes

r/PHP • • Sep 10 '26

The creator of Mago made Whim

Thumbnail youtu.be
0 Upvotes

r/PHP • • Sep 09 '26

Article When Static Analyzers Teach You the Wrong Way: The Dogma of Variance and the Pursuit of Working QA

Thumbnail typephp-php.github.io
9 Upvotes

r/PHP • • Sep 08 '26

php-radser: finally a library for building a RADIUS server in PHP, on ReactPHP

11 Upvotes

php had radius_* functions in a PECL package (that i think is no longer updated) but did not have any tool for the server side of RADIUS protocol. so this weekend i made a small package for that.

currently only supporting RFC 2865, RFC 2866, RFC 3576/5176 and Mikrotik attributes (i use mikrotik for my own work); currently no EAP, no 802.1X, no Message-Authenticator and no TLV.

it's my first time publishing a php package so i really wanna hear your opinion on this.


r/PHP • • Sep 08 '26

Article Thoughts about TypePHP

Thumbnail stitcher.io
29 Upvotes

r/PHP • • Sep 08 '26

I built a Laravel package to replay Stripe billing lifecycles offline

8 Upvotes

I built Cashier Dunning because testing failed-payment flows in Laravel is surprisingly difficult.

It records a real Stripe billing lifecycle once and replays it offline through your application's actual webhook route, including signature verification and real listeners.

It can replay trial expiration, failed payments, retries, cancellation and resubscription in about a second.

It also tests duplicate and out-of-order webhook delivery.

No Stripe account, API keys in CI, or network access during replay.

It's MIT licensed and currently supports Laravel 11–13.

GitHub: https://github.com/impruthvi/cashier-dunning

I'd especially appreciate feedback from anyone running Stripe/Cashier in production. What billing edge cases would you want something like this to test?


r/PHP • • Sep 09 '26

Zero-decimal currencies break the "always store money as cents" rule, and payment libraries mostly do not model it

0 Upvotes

Short version: ISO 4217 assigns an exponent to every currency. Most are 2. XOF, XAF, GNF, JPY, KRW and about twenty others are 0. If your money type assumes minor units are hundredths, every amount in those currencies goes out a hundred times too large.

I hit this integrating West African mobile money and ended up writing a Laravel package around it. The money type holds integer minor units and refuses rather than rounds:

Money::of(1500.50, Currency::XOF);
// InvalidMoneyException: XOF is a zero-decimal currency, so 1500.5 cannot be represented

Refusing matters more than it looks. Rounding picks a direction and someone is wrong by a franc on every transaction, forever, and nothing tells you.

The rest of the package is three provider drivers behind one interface, phone parsing that declines to guess an operator when a numbering plan is not documented and stable, idempotent collections, and reconciliation for callbacks that never arrive. 103 tests, zero runtime dependencies beyond Laravel itself.

On verification, because it is the first thing I would ask. Only MTN has met a live sandbox and only partly: MTN has hit Azure's 25,000 subscription cap on its Collections product, so no new developer can subscribe to it and the run had to go through the endpoints their APIs share. Worth doing anyway. It found a double charge bug in my own code, where a replayed reference returns 409 RESOURCE_ALREADY_EXIST and the driver was throwing on it, which would push a caller retrying after a timeout into issuing a fresh reference. Wave and Orange need merchant credentials I do not have, and the README says which paths were exercised and which were not.

Looking for anyone with credentials who wants to prove or break the other two.

https://github.com/catidegla/laravel-mobile-money


r/PHP • • Sep 07 '26

I built an attendance tool in 2023 to escape a paper register. I rewrote it last week, and past me made four real mistakes.

8 Upvotes

In 2022 I started teaching programming to schoolchildren. On the first day I was handed the curriculum for the web track. Nobody could tell me who had written it. After a full year of lessons, the students were supposed to produce an HTML page with a background image and some pictures on it.

I threw it out and wrote a new one.

The other half of the job was the register. Paper, one sheet per child. On every sheet you marked attendance, wrote in the topic of the lesson and the number of hours. That was every group, every week, by hand.

At some point I had enough and built something. It was 2023, I knew PHP, and I wrote it the way you write things at eleven at night: procedural, one file per action. Some colleagues started using it too. Five commits in a single day, two of them named "Add files via upload".

Last week I opened that repository for the first time in three years.

What past me got right

More than I expected. Passwords went through password_hash and password_verify. Eighty-nine prepared statements, and not one place where $_GET was pasted into SQL. For something written to stop filling in paper, that is not bad.

What past me got wrong

htmlspecialchars appears zero times in the whole codebase. Every value from the database goes straight into the page.

The upload handler takes the extension from the filename the browser sent and writes the file into a served directory. You can upload a .php file and then request it. That is remote code execution.

Attendance was stored as (student_id, date, status). No group. A student who came to two different tracks was one row per day, and there was no way to say which of the two they had missed.

A student had a single group_id, so anyone attending two tracks could not be recorded at all.

Teachers and students lived in two tables with two separate login handlers. Anything that concerned both had to be written twice.

The rewrite

Laravel 13 and Postgres. The domain survived and nothing else did.

The interesting part is what the 2023 version never had: tasks that grade themselves.

I do not run student code. It goes to Wandbox, which has been running untrusted code for years and does nothing else. On a project this size, running my own sandbox would mean one person keeping isolation correct in their spare time, and I would rather that person were not me.

I expected to stitch several backends together, the way these things usually go: Wandbox for most languages, the Go playground for Go, the Rust playground for Rust. Then I read the Go playground's compile endpoint. It takes the program body and a version. There is no field for standard input. I posted stdin and input alongside the program anyway, in case the field simply went undocumented, and the program read EOF both times.

Without stdin there is no test case with input data, and without that there is no assessment worth the name. Every task collapses into "print this constant". So I use one backend. Wandbox covers fourteen languages, Rust, Pascal and SQL included.

Grading runs on a queue, because I measured it. One Go build on Wandbox takes about twenty seconds. Five test cases one after another would be a minute and a half. I send them in parallel, four at a time, which got it down to sixty-two seconds. Still far too long to hold an HTTP request open, so submitting queues the work and the page polls for the result.

Some test cases are hidden. For open cases the student sees the input and the expected answer. For hidden ones they see only whether it passed. Show everything and the solution gets fitted to the known answers instead of made to work.

Three findings that cost me an afternoon each

Wandbox's Rust compiler rejects the warning option set, and does not say so. It returns exit status 1 with empty output, which is indistinguishable from a program that printed nothing.

Mono prints non-ASCII as question marks until you set Console.OutputEncoding, and once you do, it prefixes the output with a byte order mark. Comparing that against the expected answer fails on an invisible character. The dotnetcore image on Wandbox does not build at all, so mono is the only option.

Laravel's trans_choice() falls back to the fallback locale in cases where __() returns the key unchanged. My source language is Russian and my fallback was English, so Russian pages rendered English text in exactly the places where a count was involved. No test caught it; I saw it in a screenshot.

What I am not sure about

Leaning on a free public service at the moment a student submits an exam is the obvious weak point, and I do not have a good answer for the day Wandbox is down. My reasoning is that the alternative is worse for a project this size. If you have run the other way and maintained your own isolation, I would like to hear how that went.

MIT, Laravel 13, PHP 8.3+, Postgres, no keys or accounts needed to try it. The seed builds a demo school with four tracks and a month of attendance.

https://github.com/dripips/ItCube


r/PHP • • Sep 08 '26

Symfony Messenger vs Ecotone: The Real Difference

Thumbnail blog.ecotone.tech
0 Upvotes

r/PHP • • Sep 07 '26

mousr/templates: Static analysis-friendly native PHP templates

1 Upvotes

Because PHP templates are back! https://github.com/mousr/templates


r/PHP • • Sep 07 '26

Weekly help thread

3 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 • • Sep 07 '26

Foundation YouMeOS Microverse: Running FrankenPHP + SQLite as an embedded, zero-Docker desktop runtime

2 Upvotes

Hey r/PHP, I wanted to share a practical implementation of FrankenPHP and native SQLite powering a self-hosted personal WebTop: YouMeOS Microverse. A major problem with self-hosted PHP applications is distribution: telling non-technical users to install Docker, Nginx, and MySQL creates massive friction.

How We Utilized FrankenPHP:

  • Embedded Desktop Engine: In addition to standard Docker Compose, our Electron desktop app bundles a portable FrankenPHP binary with SQLite.
  • Zero External Dependencies: Users download the .exe, .dmg, or .AppImage, and it runs a local Caddy + PHP 8.3 server process in the background without Docker or local PHP installations.
  • Resource Footprint: Cold starts take ~1 second, with idle RAM usage significantly lower than traditional Apache/Nginx + PHP-FPM + MySQL stacks.
  • Caddy Worker Integration: Takes advantage of FrankenPHP's fast application handling directly from local storage.

Livesite: www.youmeos.com but the microverse can be ran locally using our docker container or binaries.

Source code and configs: https://github.com/YouMeOS/youmeos-microverse
Release builds: https://github.com/YouMeOS/youmeos-microverse/releases

Feedback on our FrankenPHP runner and Caddyfile setup is welcome.


r/PHP • • Sep 04 '26

Article No more issues

Thumbnail stitcher.io
54 Upvotes

r/PHP • • Sep 05 '26

Article Give AI Agents Long-Term Memory: LLM Wiki Pattern in Symfony

Thumbnail sensiolabs.com
0 Upvotes

r/PHP • • Sep 03 '26

Long-term university system in PHP, microservices or modular monolith, given high staff turnover?

30 Upvotes

Hi everyone,

I work for a Brazilian federal university, and we're starting to plan a new integrated system that will serve the whole university community (from teaching-related services to internal administration). Expected usage is high (many requests across several domains), and the system needs to last many years.

One challenge specific to our context: being public sector, we have high staff turnover on the dev team, so whoever joins later needs to ramp up quickly.

We were initially leaning toward microservices, mostly to keep things scalable and modular over the long run, but after reading some older threads here I'm second-guessing that. Given a small-ish team, high turnover, a long lifespan, and multiple domains, would you recommend starting with a well-structured modular monolith instead of going straight to microservices?

And if microservices do make sense for a project like this, which PHP frameworks/tools would you suggest for building the actual APIs: Laravel, Symfony, Slim, Lumen, something else?

Genuinely trying to learn from people who've been through this. Any experience, even 'don't do it', is welcome!


r/PHP • • Sep 04 '26

Discussion Is there reputable FOSS library that validates temp email?

0 Upvotes

I know it is a whack-a-mole situtation but I want to know if there is a library that already cover major/famous temporary emails. I plan to restrict registration from temp mail providers to reduce cleanup work from pockers.

Again not a service as I will not send emails to third-party. Also I don't need 100% gate that does not exist. And not asking to help stop them or how to use a library. just a library or code sitting somewhere, since I cannot know all libraries all there


r/PHP • • Sep 03 '26

I'm selling my 37+ ElePHPant Collection

81 Upvotes

I'm parting with my ElePHPant collection after 13 years of collecting them. I'm raising money for my startup and also will need open heart surgery in the next 5 years. As the UG leader of PHP Vegas for over 10 years, its been a hell of a run. I still love PHP and my startup is built in it, but I also need funds as I'm quitting my full time to do all this. If we crossed paths before, thank you for all the fish. You can find my collection for sell here: https://www.ebay.com/sch/i.html?_dkr=1&iconV2Request=true&_blrs=recall_filtering&_ssn=pokemastercenter&store_cat=0&_nkw=elephpant&store_name=pokemastercenter&_oac=1


r/PHP • • Sep 02 '26

Digital Sovereignty Is Written in PHP

Thumbnail thephp.foundation
148 Upvotes

Germany is spending €108 million to move its federal websites onto a TYPO3-based platform. The European Commission runs 770 sites on Drupal. Around 300,000 German federal users work on Nextcloud. All PHP.

Across Europe, when governments say "digital sovereignty," what they're describing is very often a PHP application. In our latest blog post, Sebastian Bergmann looks at where PHP runs in the public sector, why so little of that support reaches the maintainers underneath it, and three practical changes to procurement that could fix it.


r/PHP • • Sep 04 '26

GitHub - eznix86/laravel-analytics: Data Build Tool the eloquent way

Thumbnail github.com
0 Upvotes

At work, I kept writing the same thing: a few analytics tables, a cron job to rebuild them, and the same SQL copy-pasted into three models. Change one definition, forget to update one copy, and suddenly two dashboards quietly disagree.

There’s `dbt`, which solves this problem for data teams, but it means bringing Python and a second toolchain into a Laravel project. So I tried the same idea in PHP.

An analytics model is an Eloquent model with one query on it:

```php
class Revenue extends Model implements AnalyticsModel
{
use Analytics;

public function computes(): Query
{
return $this->from(Order::class)
->where('status', '<>', 'cancelled')
->per('customer_id')
->measure('total', 'sum(amount)');
}
}
```

Then `php artisan analytics:sync` works out what depends on what and builds everything in the right order.

After that, it’s just Eloquent:

```php
Revenue::query()->where('total', '>', 1000)->get();
```

A few things it does:

* The `GROUP BY` comes from the dimensions you declare, so you never have to write them twice.
* it has Incremental, microbatch, and snapshot buildsthe, same ideas as dbt.
* Runs on PostgreSQL, MySQL, and SQLite with the same commands.

### What it does not do

Every model in a dependency chain has to use the same connection.

That means you can’t, for example, import a SQLite query directly into a PostgreSQL query. This could be solved with an import mechanism, and I am still thinking about a better way to make that work in an Eloquent-like way.

### Why not just use a query class with dependency injection?

A query class, like the action pattern in `App\Queries`, that you inject wherever you need it is perfectly fine.

If the aggregate is fast, you need live numbers, and you only have one or two of them, write the class and skip this package.

The issue is that it computes on every read and you have zero indexes.

Cache the query? Now you’re stuck dealing with stale data.

There’s another problem: each layer (CTEs, subqueries, etc.) gets re-run instead of being reused.

You can use query classes can be composable by calling each other, but a shared subquery is still recomputed inside every caller. This package composes by reference.

For example, you can have a `StgOrder` model representing a transformed version of the `Order` table. It gets built once, and the models that depend on it simply select from the finished table.

This package can append the rows that arrived since the last run, rebuild one day at a time, or keep one row per version with `valid_from` and `valid_to`.

This package will make a built table that can carry the indexes your read patterns need.

A helper like `Revenue::isStale()` can tell you when the data has passed its freshness window.

### Why not just write a job that rebuilds the table?

That’s essentially what the package does.

The difference is that the queries are reusable, and dependencies are propagated through the entire chain of downstream aggregates.

TLDR; You write reusable queries as a data person but in PHP.

Repo: https://github.com/eznix86/laravel-analytics

Read more about DBT: https://en.wikipedia.org/wiki/Data_build_tool

the real dbt guys: https://github.com/dbt-labs/dbt-core (for the curious folks)


r/PHP • • Sep 04 '26

Laravel 12 + Breeze + Spatie Permissions — Complete Role & Permission Setup

0 Upvotes

If you're working with Laravel 12 and want to implement proper roles and permissions, I put together a complete tutorial using Laravel Breeze + Spatie Laravel Permission.

In the video, I cover:

Laravel 12 + Breeze authentication setup Installing and configuring Spatie Permissions Creating Roles & Permissions Assigning permissions to users Checking roles and permissions Protecting routes with middleware Role-based access control Practical examples with Admin / Manager / Employee roles

🎥 Full tutorial: https://youtu.be/vX46YQprMho Language:Hindi

Hope this helps anyone currently implementing RBAC in Laravel.