PHP Reddit
34 subscribers
300 photos
39 videos
25K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
Do you regularly test restoring production from backups?

Hi everyone! I wanted to ask the community: in your companies, do you practice data recovery from backups as a kind of training exercise? For example, do you run simulations where the production environment goes down and you have to quickly restore your servers and databases from those backups? I’m curious how often this is done and how it works for you.

https://redd.it/1ri1ijf
@r_php
Open sourcing a module-first Laravel SaaS foundation (Stripe billing, Filament admin, SSR, Playwright tests)

Hi everyone,

I've open sourced a project I've been using to structure larger Laravel SaaS applications: **Saucebase**.

The core idea is a **module-first architecture** where features install directly into your application instead of living inside vendor packages, inspired by the copy-and-own philosophy behind shadcn/ui.

When you install a module, the code lands in `/modules` in your repo. It's yours. Each module owns its:

* Routes
* Migrations
* UI (Vue pages + components)
* Config
* Policies
* Tests (PHPUnit + Playwright)
* Business logic

Modules integrate through Laravel service providers and auto-register their routes, migrations, assets, and navigation. The app grows by composition while keeping full code ownership, no vendor lock-in. (using nWidart/laravel-modules)

**Stack**

* Laravel 12 + PHP 8.4
* Vue 3 (Composition API) + Inertia.js 2.0
* TypeScript 5.8
* Tailwind CSS 4
* shadcn-vue components
* Docker (with auto SSL certs)
* SSR support (opt-in per page)

**What's included**

* Auth module (login, register, password reset, email verification, etc)
* Socialite authentication (Google, GitHub)
* Filament 5 admin panel
* Roles & permissions (via Spatie)
* User impersonation with recent history
* Stripe billing (subscription flow)
* Modular navigation system (modules register their own nav items)
* PHPStan level 5, Pint, ESLint, commitlint
* PHPUnit + Playwright E2E, pre-configured per module
* One-command setup: `php artisan saucebase:install`

>Create your own ***recipes*** based in existing modules.

**Why not just use a traditional starter kit?**

Most starter kits keep you inside their package. You can't easily customize auth logic, change how billing works, or restructure features without hacking around the package's assumptions. You can still installing vendor packages, but you likely need to integrate manually.

With Saucebase, the first `composer require saucebase/auth` copies the code into your repo and that's it , you're the vendor from day one. If the module has some update, just run `composer update` and merge the changes yourself.

Still in active development, not production-ready yet. Looking for feedback from people building real SaaS products - what would you add, remove, or do differently?

* GitHub: [https://github.com/sauce-base/saucebase](https://github.com/sauce-base/saucebase)
* Demo: [https://demo.saucebase.dev/](https://demo.saucebase.dev/)
* Docs: [https://sauce-base.github.io/docs/](https://sauce-base.github.io/docs/)

https://redd.it/1ri1uc0
@r_php
I built a Claude Code plugin that enforces hexagonal architecture in Symfony projects

Hey everyone,

I've been working on Symfony projects for a long time and one thing always frustrated me: projects start clean, but over time the architecture gets messy.
Business logic leaks into controllers, repositories get called directly from handlers, and before you know it, you have a big ball of mud.

So I built a Claude Code plugin that automatically enforces hexagonal architecture (ports & adapters) in Symfony projects. It works as a development companion,
not a one-time generator.

What it does:

- Works with both new and existing projects. New projects get full scaffolding, existing ones can adopt module by module
- Enforces strict dependency rules: domain layer stays pure PHP, no framework imports allowed
- Generates CQRS patterns (commands for writes, queries for reads) with dedicated handlers
- Side effects go through domain events, never direct calls between handlers
- External interactions always route through port interfaces

It comes with 10 auto-triggered skills:

Architecture scaffolding, domain modeling, CQRS setup, port/adapter design, API response patterns, async messaging, security voters, persistence layer,
validation, and testing workflows.

Two built-in review agents:

- Architect agent analyzes your structure and gives a compliance score (0 to 100)
- Reviewer agent checks code changes and flags violations as CRITICAL, WARNING, or INFO

The main goal was simple: I wanted my team to follow the same architectural rules without spending hours in code reviews debating "where should this code go?"
Now everyone gets instant feedback while coding.

It is open source and MIT licensed. I would really appreciate any feedback, especially from people who work with hexagonal architecture or DDD in Symfony.

GitHub: https://github.com/aligundogdu/symfony-hexagonal-skill

Thanks for reading!

https://redd.it/1ro4y5y
@r_php
PDO has no interface after 20 years - does it deserve a PSR or an RFC?

Aura.Sql, lazypdo, and Doctrine DBAL have all independently worked around the same gap. I wrote about what a minimal standard PdoInterface could look like, and the two realistic paths forward: a PHP-FIG PSR or a language-level RFC (similar to DateTimeInterface in PHP 5.5).

Would be curious to hear from library maintainers especially: does the absence of a standard interface affect your design decisions?

https://maximegosselin.com/posts/in-search-of-the-missing-pdo-interface/

https://redd.it/1rntvym
@r_php
On the 100-Million-Row challenge, my debt to PHP, and why I decided to inject Rust into it (Introducing Lyger v0.1)

Hey everyone! 👋

I recently came across the [100-Million-Row Challenge](https://www.reddit.com/r/PHP/comments/1re55vn/introducing_the_100millionrow_challenge_in_php/) post here in the sub. I found it to be a fascinating experiment, but let's be honest: processing 100 million records in pure PHP is always going to be a headache. No matter how much we optimize functions and avoid loading objects into RAM, we end up fighting the physical barriers of the language itself and synchronous blocking.

This got me thinking about something that's been on my mind for months. Whenever people ask me what the "best" programming language is, my answer usually disappoints the purists: *"The best language is the one that puts food on the table for you and your family."*

For me, that language was PHP. It fed me and my family for many years, even when things got really tough. I owe my career to it. However, over time I realized that neither history nor the architecture of traditional frameworks have been entirely fair to it. As PHP developers, we constantly deal with massive memory consumption, response time bottlenecks, and the endless suffering of object hydration in PDO.

Since I've been working deep in the Rust ecosystem lately, building a data processing engine (pardoX), an idea kept me awake at night: **How viable would it be to inject the raw performance of Rust into a PHP framework using FFI?**

I got to work, and the result of these past few months is **Lyger v0.1**

I called it Lyger because it's exactly that: a hybrid. You write your business logic with the elegant, fast syntax we love in PHP, but under the hood, a native HTTP server in Rust intercepts the requests and handles the heavy lifting.

A few things we managed to implement in this version:

* **Goodbye PDO (Zero-Copy):** Rust handles the direct, asynchronous connection to PostgreSQL, MySQL, and SQLite. Rust runs the query, keeps the data in its memory, and passes only a pointer to PHP. This gave us \~300x faster asynchronous inserts.
* **"Always-Alive" Memory:** By keeping PHP as a persistent worker in memory, Lyger consumes a stable **2 MB**, eradicating the PHP-FPM restart cost that, in frameworks like Laravel, costs you gigabytes at scale.
* **Modern DX:** An interactive CLI (`php rawr install`) that cleans up unused code and lets you choose between Vue, React, or Svelte as your frontend from second zero.

I know perfectly well that Lyger cannot enter the official 100 million rows challenge because the rules explicitly disallow the use of FFI, and I respect that—that's the exact spirit of the challenge. But my vision with this project goes in a different direction.

I'm here to share the repository and invite you all to take a look:

**GitHub Repo:** [https://github.com/betoalien/Lyger-PHP-Framework](https://github.com/betoalien/Lyger-PHP-Framework)

I want to hear your honest opinions. Test it, break it. But above all, I'd like this thread to be a space **without toxicity or framework wars**. I'm not here to say that Framework X is trash; I'm here because I love PHP, and I believe that if we support each other, we can build tools that push our language far beyond its historical limits.

What do you think of this hybrid architecture? I'll wait for your PR in Github

https://redd.it/1ronqgf
@r_php
Weekly Ask Anything Thread

Feel free to ask any questions you think may not warrant a post. Asking for help here is also fine.

https://redd.it/1rop3qv
@r_php
Architecture decisions for a production Filament 5 app — PHPStan max, strict lazy loading, JSONB custom fields
https://redd.it/1rkqqjc
@r_php
What are you using for your PHP dev setup?

I have decided to shift away from front-end development and get back into PHP. Back in the day I used XAMPP, but since I have moved to Linux and we're living in the future, I wanted to go for something more modern while still keeping it relatively simple.

My goal was to make a rootless Podman container running FrankenPHP in classic mode. That way I would keep the toolchain off the host machine, preventing conflicts between projects using different versions of PHP and also making it easier to recreate the environment. After a bit of a struggle getting it all working, I have realized that VS Code needs PHP for validation and stuff. I have tried making a wrapper that would forward VSC's requests to PHP inside the container, but that ended up being sloooow.

Before burning any more time, I have decided to check around the Internet for what people were using. I have seen Laravel's Sail, Laragon, Lando, DDev and possibly others. However, from my brief examination it looked like they all basically do the same thing I was trying, they just set up some extra tools. I would like to keep the control of doing things manually, and they wouldn't actually solve the VSC/PHP issue as far as I can tell.

So, what are you guys doing? Are you using a container and eating the delay (or is there a solution for that)? Are you developing old-school directly on the host OS (how are you managing PHP versions)? Or is there something else you would recommend?

EDIT: Whew, thanks for all the responses, everyone.

One thing I forgot to mention in the post is that, even though I'm using VS Code for now, I'm trying not to get locked down in proprietary stuff. Attaching to Docker container (which I have conflated with Dev Containers in some comments, my bad) requires a proprietary Microsoft extension. The only equivalent in other editors seems to be in PHPStorm. However, I have now realized that Intelephense doesn't actually rely on a PHP interpreter, which should allow me to sidestep that issue.

Those ready-made container solutions seem to be really popular, so I think I might give Ddev a closer look.

https://redd.it/1rnkta8
@r_php
Deploy & Update automation

TL/DR: what are anno 2026 the best options to automate and manage deploying & updating +200 Symfony application+mysql instances?

A bit of context first: I'm a freelance developer who worked mostly in enterprise environments for the past decade, using multiple techstacks (mostly .NET, node, react, graphQL...) deploying to both on-prem infrastructure using TeamCity as to Azure AKS and some legacy stuff using github actions. But we always had a capable DevOps team handling the config & security setup.
Now I've joined a former colleague who started his own business years ago, who has a software suite and a solid userbase (+200 clients) but his associate & lead dev left and I've agreed to bridge the gap and help him out. I do have +10y experience with PHP Laravel&Symfony though mainly smaller apps & websites, no real scaling experience (I maintain around 10 apps hosted on my own dedicated servers at OVH - lots of headroom costing around 200$ a month).


They currently use Ansible to deploy an application instance-per-client, each with it's own isolated database, but there's no real dashboard or management tool to govern all this.
Now that they continue to scale they are running into issues as it's always the company owner handling deploys & upgrades, lots of manual work. His hosting cost currently runs at 2500-3000$/month.
They are in the middle of stripping out all Laravel dependencies and creating a new version following Symfony8 best practises, but still no (shared runtime) multi-tennant solution - it remains a seperate instance per client and the owner wants to keep it like that.
Looking at average loads etc, it would make sense to put some clients on a seperate VM while other could easily be grouped into 5-10 per server instance.
All clients are local to Belgium & the Netherlands as the application's function is to handle local administration & regulations (also does accounting & erp & process automation etc). Expansion to Germany & France are on the long-term roadmap - expected growth around 25% a year.

What are good options here? Both for hosting as for orchestration & automation tooling.
Free tooling compared to complete PAAS solutions?


https://redd.it/1rou542
@r_php
finally found a bundle that solves Symfony validation the way it should work

been frustrated with validation boilerplate in Symfony for a while, tried a few approaches, nothing felt clean

this one uses JSON Schema as single source of truth — no more scattered constraints, works well with OpenAPI too. prety much validates anything without the usual mess

if ur building APIs with Symfony u probably know the pain. drop a comment if u want the link, happy to share

https://redd.it/1rov8ud
@r_php
Weekly help thread

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!

https://redd.it/1rot8d7
@r_php
I wrote a free book about Domain-Driven Design in Laravel

I’ve been using DDD for a long time, so about 3 months ago I wrote a small book about applying it in Laravel. I didn’t publish it right away because I wanted to simplify it as much as possible. I’m not a big fan of heavy theory, so the book is very practical. Enjoy...

https://mayahi.net/books/domain-driven-design-in-laravel

https://redd.it/1rpagd1
@r_php
TIL There's a built-in validation rule in Laravel to check if the user password has been leaked before. I love finding these little gems out of nowhere.

https://redd.it/1rr4s2e
@r_php