PHP Reddit
31 subscribers
308 photos
40 videos
25.3K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
Redesigned my Stopwatch profiler with ui.sh (before/after)

Bought a ui.sh license a few months back. Closed the tab, forgot about it. Sat down with it properly this week and ended up rewriting the HTML render of one of my packages in an evening. Left side of the image is 0.4.x. Right side is what I tagged today.

before\/after

It's a small Laravel profiler I maintain (SanderMuller/Stopwatch). You drop checkpoints, it shows where time went. The render had been the same plain table forever. On my "tomorrow" list for at least a year.

You describe what you want, you get 2–3 directions back, you pick one. First round is usually whatever, by round 3 or 4 I was tweaking actual details. It noticed I had CSS variables in the file and themed around them instead of replacing them, which I appreciated.

Iterations aren't mockups either. Sometimes you get a screenshot, sometimes a carousel of live versions you can actually click through. At one point a tooltip kept misaligning, turned out a parent transform was making a new containing block, and we ended up restructuring the DOM.

Went in just wanting visual polish, ended up adding a bunch of stuff I hadn't planned. Overview bar with per-checkpoint segments. Tiered slow highlighting. A light/dark toggle. A clipboard button that copies a Markdown summary so I can paste slow profiles into Claude. Half of those came from the tool nudging me — like, it suggested theme support and I realized yeah, I'd actually use that. Also inline-styled with hex fallbacks so the same render works in notification emails, which was a pain.

If you use /ui or ui.sh, what do you point it at? I've mostly done component-level things, would love to hear if anyone's used it for marketing pages or full app shells, and whether you've found an iteration workflow that holds up. I kept losing track of which round had the best version of which detail. Felt like I needed git for screenshots.

If you haven't tried it, what's stopping you? Price, generic-AI-design vibes, prefer to write the CSS yourself?

Paying customer, not affiliated.

https://redd.it/1swcbrv
@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/1swrvl3
@r_php
Scramble 0.13.21 – Laravel API documentation generator update: JSON:API support, `toResource` and `toResourceCollection` support, Laravel Query Builder improvements
https://scramble.dedoc.co/blog/scrambledrop-scramble-01321

https://redd.it/1swx6qa
@r_php
PHPArkitect 1.0 is out. Curious how people approach architecture testing in PHP these days

Just tagged 1.0 of PHPArkitect after a long stretch of small releases, and figured I'd post here partly to share it and partly because I'm genuinely curious about how (or whether) people use this kind of tool.

If you haven't seen it: it's a way to write architectural rules as PHP code and fail your CI when something violates them. Stuff like "nothing in App\Domain is allowed to depend on App\Infrastructure" or "all controllers' class name must end in Controller".

A rule looks like this:

  Rule::allClasses()
->that(new ResideInOneOfTheseNamespaces('App\Domain'))
->should(new NotHaveDependencyOutsideNamespace('App\Domain'))
->because('we want to protect our domain from external dependencies');


The 1.0 mostly cleans things up rather than adding huge new features. Baseline matching is smarter, PHP core classes (Exception, DateTime, PDO...) are auto-excluded so you stop having to list them in every rule, there's HaveTrait /NotHaveTrait, IsNotA, recursive in excludePath, and catch / @throws are now picked up as dependencies. PHP 7 support is gone and the PHAR build was hardened with php-scoper.

Repo if you want to poke around:
https://github.com/phparkitect/arkitect

What I'd actually like to know:

- Anyone here using PHPArkitect, Deptrac, or rolling something custom?
- If you do use one, what did you mainly use it for? What problem were you actually trying to solve?
- If you tried one and stopped, what was the breaking point?

I have my own theories but they're probably biased, so happy to be told I'm wrong

https://redd.it/1swy82y
@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/1swv2s1
@r_php
GitHub Copilot cambia su modelo de precios en mayo 2026: ¿qué significa para los desarrolladores?

GitHub Copilot cambia su modelo de precios en mayo 2026: ¿qué significa para los desarrolladores?



GitHub ha anunciado cambios significativos en GitHub Copilot que entrarán en vigor durante mayo 2026. La compañía pasa a un esquema más orientado al uso real, ante el fuerte aumento de costos generado por los nuevos flujos de trabajo agénticos.



Principales cambios:



*Se pausan las nuevas suscripciones a los planes Pro, Pro+ y Student.

*Se endurecen los límites de uso en los planes existentes.

*El modelo Opus de Anthropic desaparece del plan Pro (10 USD/mes) y solo estará disponible en Pro+ (39 USD/mes).



Según documentos internos, el costo semanal de operar Copilot se ha duplicado desde enero 2026. Una sola sesión agéntica puede consumir más recursos que docenas de autocompletados tradicionales, lo que ha llevado a que algunos usuarios de 10 dólares mensuales generen costos de cientos de dólares por semana.



La buena noticia para los usuarios actuales:

Los suscriptores existentes de Copilot Pro mantienen su acceso sin modificaciones en sus condiciones actuales. Los cambios afectan principalmente a nuevos suscriptores y a los límites de uso futuros.



Microsoft y GitHub justifican estas medidas como necesarias para “proteger la experiencia de los clientes existentes” ante el explosivo crecimiento del consumo de IA.



¿Estás usando Copilot? ¿Cómo crees que te afectará este cambio?



\#GitHubCopilot #GitHub #InteligenciaArtificial #Desarrolladores

Khainata

https://redd.it/1sxcxb9
@r_php
Implementing BCrypt in pure PHP - Handling 32-bit logic on 64-bit systems

Hey everyone, I’m currently writing my Bachelor’s thesis, which is actually a continuation of a project started by a previous student. Their work covered several other cryptographic primitives and the whole thing was built in Laravel, so I’m stuck implementing BCrypt in pure PHP to keep everything consistent within that same codebase.

The main issue is that BCrypt is fundamentally built on 32-bit unsigned integer math, but modern PHP uses 64-bit signed integers. I’m having a hard time figuring out the cleanest way to handle the overflows so that the variables wrap around exactly like they would in C. If they don't, the internal state of the P-array and S-boxes gets totally messed up.

I’ve been looking at a few ways to handle this. One option is to just use bitwise masks like & 0xFFFFFFFF after every single addition, XOR, or shift. It seems like the most direct way to force a 32-bit state, but I’m worried my code is going to look like a total mess of masks for my final submission. I’ve also thought about using modulo math to handle the wrap-around, but I’ve heard that can get pretty weird in PHP when dealing with negative results or very large integers.

The other headache is that PHP doesn't have a native unsigned right shift (>>>). I’m trying to simulate it by shifting and then manually clearing the sign bit with a mask, but I’m worried about the performance and accuracy since the algorithm has to do thousands of iterations for the key schedule.

If you were in my shoes and had to stay within PHP to match the existing Laravel setup, how would you go about the 32-bit manipulation? Would you stick to heavy masking, try to abstract it into helper methods, or is there some other way to handle low-level bitwise stuff that I’m missing? I’d really appreciate any insight from people who have messed with this kind of thing before. Thanks!

https://redd.it/1sxdj6m
@r_php
Phalanx - managed async PHP 8.4+

Curious what ya'll think here

https://phalanx-php.com/

This is an ongoing idea I've been building since late 2024. Nights and weekends, then AI really hit, so it's been a back burner for me, but I really think async PHP is full of untapped potential. Don't be surprised if you find bugs, Ive got a couple apps in prod that work great but it's been a lot of work/ground to cover - I'm interested in the POC so it's worth it:

E.g.

PHP AI lib:

https://github.com/phalanx-php/phalanx-athena

PHP dev server (w/buns help):

https://github.com/phalanx-php/phalanx-skopos

PHP Networking:

https://github.com/phalanx-php/phalanx-argos

UI (inertia with a twist, uses tanstack start/query):

https://github.com/phalanx-php/phalanx-eidolon

Some are very early development, likely best to ignore them:

Terminal

CDP

https://redd.it/1sxf7cn
@r_php
Is the PHP market shifting or just stalling? My experience trying on moving to Scandinavia

Hi everyone,

I wanted to get a temperature check on the current PHP job market. I’ve been working primarily with Symfony and Laravel (handling high-transaction systems, CQRS, and microservices), but lately, finding quality PHP roles—let alone getting an interview—has felt like a bit of an uphill battle.

I'm currently preparing for a move from Portugal to the Lund/Copenhagen area (Øresund region) in September. While I see a lot of talk about PHP's "renaissance" with the 8.x improvements, and the new libraries appearing but the actual job boards seem to be dominated by Go, Node, Java or C(#,++...).

A few things I’m curious about:

1. Market Sentiment: For those of you in Europe (especially the Nordics/Denmark), are you seeing a decline in new PHP projects, or is it just that companies are hiding these roles behind recruiters/referrals?
2. The "AI Filter" Struggle: Is anyone else feeling that their CV gets "ghosted" by AI filters despite having solid production experience? I’ve been trying to bypass the "black hole" of LinkedIn applications by looking for direct referrals (what feels impossible to get too -_-), as the traditional route feels broken right now.
3. Future-Proofing: Are you guys sticking strictly to PHP, or are you finding that you must pivot to Go or Python to stay relevant in the high-performance backend space? (I've personally started building my side projects in Go/Python to bridge this gap, even trying node.....).
4. Are we becoming the "maintenance-only" crew?

I love the PHP ecosystem and the speed of delivery it offers, but the "no-interview" streak is starting to make me wonder if the market is moving away from it faster than we'd like to admit.

https://redd.it/1sxwauo
@r_php
Laravel Shield

Just released a new project: Laravel Shield

While working with Laravel, I noticed that many developers only think about security after something goes wrong. I wanted to change that by building a tool that encourages a more proactive approach.

Laravel Shield is a package that scans Laravel applications to help identify potential security issues early in development.

What it offers:

Scans your codebase for common security risks
Highlights insecure patterns and bad practices
Provides output in both console and JSON formats
Helps developers understand and improve application security

The goal is simple: make security awareness part of the development process, not an afterthought.

This project is especially useful for developers who are learning Laravel security or building production-ready applications.

Repository:
https://github.com/Mana007777/Laravel-Shield

Feedback, suggestions, and contributions are welcome.

https://redd.it/1sy0923
@r_php
AI rewards strict APIs

I wrote a blog post about why AI agents struggle with loose APIs (magic strings, untyped hooks, unvalidated configuration) more than humans do.

The post uses Drupal and WordPress as examples, but the argument applies to any framework on the strict-to-loose spectrum.


https://dri.es/ai-rewards-strict-apis

https://redd.it/1sy1vke
@r_php
I spent 30 days building a high-load task orchestrator on PHP 8.4 + Swoole + NATS to kill the "PHP is slow" myth. Live demo included.

Hey Reddit,

I've been writing PHP for 25 years, and I'm tired of the "PHP is slow / only for CRUD" myth. So I built [Fast Atomic Flow](https://fast.af.l3373.xyz) — an atomic task orchestrator that combines PHP 8.4 (Swoole), NATS JetStream, and a Go WebSocket proxy.

**The Tech Stack:**

* Backend: PHP 8.4 + Swoole (coroutines, shared memory, atomics for global semaphores)
* Static Analysis: PHPStan Level 10 — maximum strictness
* Broker: NATS JetStream (guaranteed delivery, zero message loss)
* Proxy: Go WebSocket proxy (handling thousands of connections)
* Protocol: Custom 13-byte binary protocol
* UI: Real-time Canvas-based "Worker Heatmap" with LOD (Level of Detail) rendering

**Why?**

I wanted to prove that PHP can be predictable, memory-leak-free, and blazing fast — if you know how to handle the engine. No race conditions. No overhead. Just pure flow.

**The story:**

Built solo, 30 days of actual commit time contributed. After a brutal divorce and job loss, I moved to the countryside and rebuilt my life — and my code — from scratch.

**Secret Ingredient:** Two-Hooved Programming

Was it really solo? Technically yes. But I had a digital sidekick — an AI (DeepSeek). We worked side-by-side. I architected the system, it wrote the boilerplate. We argued, we joked, we fixed deadlocks at 4 AM together. This is the result.

**Live Demo:** [https://fast.af.l3373.xyz](https://fast.af.l3373.xyz)

(Note: Server is in Europe; US users may experience network latency. You can switch between different UI themes in the footer).

🎮 **The Demo Game:**

Spammers: Can fire a payload of up to 1,500 tasks, 20 times per minute.

Concurrency: Adjustable from 1 to 255.

Cleaners: Can purge the queue up to 5 times per 5 minutes.

The Rules: Max queue capacity is 32,768 tasks. New tasks are simply discarded if the queue is full.

Semaphore & Retry Tuning:

* Lock timeout: 5 seconds;
* Retry delay: 1 second;
* Max retries: 3.

If a task can't acquire a semaphore slot, it retries up to 3 times, then gets discarded. No deadlocks, no infinite loops.

Let's see if the semaphore holds the line!

>⚠️ Note: The UI works on mobile (tested on iPhone 13), but it's not responsive. For the best "horse-power" experience, please use a desktop browser.

**GitHub:** [https://github.com/shmandalf/fast-atomic-flow](https://github.com/shmandalf/fast-atomic-flow)

License: KBL v3.0 (Horses don't abandon horses.)

Would love your feedback on the semaphore implementation and the binary protocol!

https://redd.it/1sy50xl
@r_php
statgrab 2.2: cross-platform system stats for PHP, picking up the 2005 PECL extension

A while back I pushed a small PECL extension that wrapped libstatgrab and exposed CPU, memory, disk I/O, network, and process statistics to PHP. It sat untouched for most of the PHP 5/7 era and stopped building cleanly on PHP 8 a few years back. I shipped 2.2 today, a full modernization of the binding for PHP 8.0 through 8.5 against libstatgrab 0.92+.

The reason to revive it: nothing on the PHP side has replaced it. If you need system stats from PHP, you are typically choosing between three options.

- Shell out to w, vmstat, df, ps. The output format drifts between OS releases, and you end up writing a per-tool parser.
- Parse /proc by hand. Linux-only, every file (meminfo, loadavg, diskstats, net/dev) has its own format and edge cases.
- Run a separate stats daemon and hit it over a socket. Adds a daemon to deploy and keep running.

libstatgrab itself is the right primitive: a cross-platform C library that handles /proc on Linux, kvm on FreeBSD, and the Mach host_* APIs on macOS, and exposes one typed surface. It just needed a PHP binding that worked on a current interpreter.

The 2005 procedural API is preserved (sg_cpu_percent_usage, sg_memory_stats, etc.) for drop-in compatibility, with a new OO surface (Statgrab::cpu(), ::memory(), ::processes()) on top.

While running ASan on the new test suite I caught a memory leak in libstatgrab's shutdown path. Patch submitted upstream; pending review. The repo carries a vendored libstatgrab 0.92.1 with the local fix in the meantime. Build with --with-statgrab=bundled to get a single .so with no runtime dependency on libstatgrab.so. Useful in any deployment where you don't want to require libstatgrab as a system package.

Install:

pie install iliaal/statgrab

Or pecl install statgrab if you are still on the legacy installer. Source build and the bundled-libstatgrab path are in the README.

Repo: https://github.com/iliaal/statgrab
Full write-up: https://ilia.ws/blog/its-alive-statgrab-returns-after-20-years

https://redd.it/1sycnhm
@r_php
I just released my first open source project - Spectacular - a functional specification tool built in Laravel

Like most side projects, this was born out of frustration. As a developer, I hated getting vague requirements scattered over Basecamp, Jira, Slack and emails. Oftentimes, it was lazy project managers using agile as an excuse for not planning. So I made a tool for building detailed yet readable functional specifications (not just UML weirdos!).

I've noticed recently that specifications are cool again but for the wrong reasons. People write specs primarily for LLMs rather than for other people. Spectacular is aimed at making specifications accessible to everyone: project managers, developers, stakeholders as well as AI coding agents. It has worked great for my clients over the years and I'm pleased to have had time in the last few months to prepare it for public release.

So here it is: **Specacular - an open source specification tool built in Laravel and Vue**. You can install it locally or just use the hosted version: [https://spec.tacul.ar](https://spec.tacul.ar)

I hope many of you find it a worthy addition to your workflows.

\---

Sales pitch over, let's talk code.

It's pretty standard Laravel and Vue (with a few exceptions). The API uses [Laravel Actions](https://www.laravelactions.com/) instead of controllers so any future extensions like MCP services don't need to duplicate code.

The [SharesRelation](https://github.com/syntheticminds/spectacular/blob/main/app/Rules/SharesRelation.php) rule is a nifty way to check two models are related via a common ancestor (a User and a Feature belong to the same Project via User->Project->Feature).

'user_id' => [new SharesRelation(User::class, 'feature_id', 'project.features')],

Some might be interested in how a "solo" mode disengages authorisation; [Sanctum config](https://github.com/syntheticminds/spectacular/blob/main/config/sanctum.php) takes an array of guards so it will fall back to [a custom guard](https://github.com/syntheticminds/spectacular/blob/main/app/Providers/AppServiceProvider.php) that returns an ephemeral default user and opens the Gate for them.

Sqids (the new version of Hashids) are encoded using an attribute on the trait and [a castable](https://github.com/syntheticminds/spectacular/blob/main/app/Casts/AsSqid.php) is used for foreign keys. The decoding is done in route binding and at the [middleware](https://github.com/syntheticminds/spectacular/blob/main/app/Http/Middleware/DecodeSqids.php) level for input. I found this to be tider than prepareForValidation().

$router->post('requirements/add', static::class) ->middleware('sqids:feature_id,actor_ids.*');

On the Vue side: when I migrated this project from Vue 2 to Vue 3 years ago, Pinia ORM was a bit buggy so I implemented my own lightweight ORM that uses [Collect.js](https://collect.js.org/usage.html). I actually really like it because it works like [a very basic Eloquent](https://github.com/syntheticminds/spectacular/tree/main/resources/js/stores).

This is my first time releasing a project like this so I'm looking forward to hearing your thoughts. It's getting pretty late so I'll check back in the morning.

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