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
I used multiple Claude Code instances to build and test a Laravel package across 3 production codebases
/r/laravel/comments/1sl3ckm/i_used_multiple_claude_code_instances_to_build/

https://redd.it/1sl3d4l
@r_php
Is EasyAdmin still worth it with a lot of customisation?

Hey all!

I've used EasyAdmin to quickstart a back-office with a ton of (sometimes massive) forms. It works great but the more I customise its appearance, the more I feel I'm working against it.

Question: When does it lose out to plain symfony forms and twig templates? Any experience would be much appreciated!

Here's a handful of examples for context:

- boolean fields replaced with a custom tri-state toggle to track true-false-null values

- choicefields displayed as a row of buttons row to view all options at once and pick in one click

- collections of images with an extra link to view the existing file in a new tab

- collection displayed as a custom matrix (properties as rows, objects as columns, values in cells)

Some of these rely on Stimulus, ultimately I may even switch to Turbo.

https://redd.it/1sl6aci
@r_php
25 years to the day !! of my first surviving open source PHP project: PHP-Egg, born 13 April 2001. FIrst PHP Daemon. First RFC PHP client (IRC). First long-running (months on end) PHP process.
https://github.com/hopeseekr/phpegg

https://redd.it/1sl89rw
@r_php
I built a modern and clean PHP wrapper for Android ADB (xvq/php-adb)

**Hi Reddit,**

**I built this a while back** when I was working on some Android automation projects. At the time, I found that the PHP ecosystem lacked native ADB (Android Debug Bridge) libraries. I was forced to switch to Python or Go for device interactions, but the context-switching cost was too high for my workflow.

So, I developed **xvq/php-adb**. This library is **heavily inspired by the Python** [**openatx/adbutils**](https://github.com/openatx/adbutils) **library**, aiming to bring that same ease of use to PHP.

**Features:**

* **Device Management:** List, connect, and switch between devices (supports wireless ADB).
* **Shell Commands:** Execute adb shell commands and get output as strings or arrays.
* **Input Control:** Support for screen taps (clicks), key events, and text input.
* **Port Forwarding:** Manage forward and reverse port mapping.
* **File Transfer:** Built-in `push` and `pull` support.
* **App Management:** Install, uninstall, and clear app data.
* **Screenshots:** Capture screen directly to local files.

**Quick Example:**

PHP

use Xvq\PhpAdb\Adb;

$adb = new AdbClient();
$device = $adb->device('emulator-5554');

// Tap at coordinates
$device->input->tap(500, 1000);

// Press Home button
$device->input->keyEvent(KeyCode::KEY_HOME);

// Screenshot
$device->screenshot('./debug.png');


I hope this helps anyone doing Android automation within the PHP ecosystem. Feedback and bug reports are welcome!

**GitHub:** [https://github.com/xvq/php-adb](https://github.com/xvq/php-adb)

https://redd.it/1sl81xx
@r_php
Bootgly v0.13.0-beta — Pure PHP HTTP Client (no cURL, no Guzzle, no ext dependencies) + Import Linter

Hey r/PHP,

I just released v0.13.0-beta of Bootgly, a base PHP 8.4+ framework that follows a zero third-party dependency policy.

Just install php-cli, php-readline, and php-mbstring for PHP 8.4, and you'll have a high-performance HTTP server and client (see Benchmarks bellow)! No Symfony components, no League packages, nothing from Packagist in the core.

This release adds two main features:

# 1. HTTP Client CLI — built from raw sockets

Not a cURL wrapper. Not a Guzzle fork. This is a from-scratch HTTP client built on top of stream_socket_client with its own event loop:

All standard methods (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS)
RFC 9112-compliant response decoding — chunked transfer-encoding, content-length, close-delimited
100-Continue two-phase requests (sends headers first, waits for server acceptance before body)
Keep-alive connection reuse
Request pipelining (multiple requests queued per connection)
Batch mode (batch() → N × request()drain())
Event-driven async mode via `on()` hooks
SSL/TLS support
Automatic redirect following (configurable limit)
Connection timeouts + automatic retries
Multi-worker load generation (fork-based) for benchmarking

The whole client stack is \~3,700 lines of source code (TCP layer + HTTP layer + encoders/decoders + request/response models) plus \~2,000 lines of tests. No magic, no abstraction astronautics.

Why build an HTTP client from scratch instead of using cURL? Because the same event loop (`Select`) that powers the HTTP Server also powers the HTTP Client. They share the same connection management, the same non-blocking I/O model. The client can be used to benchmark the server with real HTTP traffic without any external tool.

# 2. Import Linter (bootgly lint imports)

A code style checker/fixer for PHP `use` statements:

Detects missing imports, wrong order (const → function → class), backslash-prefixed FQN in body
Auto-fix mode (`--fix`) with `php -l` validation before writing
Dry-run mode
AI-friendly JSON output for CI integration
Handles comma-separated use, multi-namespace files, local function tracking (avoids false positives)

Built on token_get_all() — no nikic/php-parser dependency.

# Benchmarks (self-tested, WSL2, Ryzen 9 3900X, 12 workers)

Numbers below reflect *v0.13.1-beta*, a patch release with HTTP Client hot-path optimizations (+29.6% throughput) and cache isolation tests.

Scenario: 1 static route (Response is 'Hello, World!'), 514 concurrent connections, 10s duration.

|Runner|Req/s|Latency|Transfer/s|
|:-|:-|:-|:-|
|Bootgly TCP_Client_CLI|629,842|553μs|81.69 MB/s|
|WRK (C tool)|595,370|—|—|
|Bootgly HTTP_Client_CLI|568,058|1.07ms|56.95 MB/s|

Three different benchmark runners, all built-in (except wrk). The TCP client sends raw pre-built HTTP packets — that's the theoretical ceiling. The HTTP client builds and parses real HTTP requests/responses with full RFC compliance — that's the realistic throughput. WRK sits in between. All three confirm the server sustains 568k–630k req/s on a single machine with pure PHP + OPcache/JIT.

To provide context: Workman at TechEmpower Round 23 — the fastest pure PHP framework there — achieved approximately 580,000 requests per second on dedicated hardware. Bootgly reaches that level, with a difference of about 3% (a technical tie).

Why this absurd performance?

I tried replacing stream_select with libev or libuv and it got worse — the bottleneck is in the C ↔️ PHP bridge, not in the syscall.

The C → PHP callback dispatch via zend_call_function() is approximately 50% more expensive than a direct PHP method call. Many people don't know this, but stream_select
Bootgly v0.13.0-beta — Pure PHP HTTP Client (no cURL, no Guzzle, no ext dependencies) + Import Linter

Hey r/PHP,

I just released [v0.13.0-beta](https://github.com/bootgly/bootgly/releases/tag/v0.13.0-beta) of [Bootgly](https://github.com/bootgly/bootgly), a base PHP 8.4+ framework that follows a zero third-party dependency policy.

Just install `php-cli`, `php-readline`, and `php-mbstring` for PHP 8.4, and you'll have a high-performance HTTP server and client (see Benchmarks bellow)! No Symfony components, no League packages, nothing from Packagist in the core.

This release adds two main features:

# 1. HTTP Client CLI — built from raw sockets

Not a cURL wrapper. Not a Guzzle fork. This is a from-scratch HTTP client built on top of `stream_socket_client` with its own event loop:

* All standard methods (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS)
* RFC 9112-compliant response decoding — chunked transfer-encoding, content-length, close-delimited
* 100-Continue two-phase requests (sends headers first, waits for server acceptance before body)
* Keep-alive connection reuse
* Request pipelining (multiple requests queued per connection)
* Batch mode (`batch()` → N × `request()` → `drain()`)
* Event-driven async mode via `on()` hooks
* SSL/TLS support
* Automatic redirect following (configurable limit)
* Connection timeouts + automatic retries
* Multi-worker load generation (fork-based) for benchmarking

The whole client stack is \~3,700 lines of source code (TCP layer + HTTP layer + encoders/decoders + request/response models) plus \~2,000 lines of tests. No magic, no abstraction astronautics.

**Why build an HTTP client from scratch instead of using cURL?** Because the same event loop (`Select`) that powers the HTTP Server also powers the HTTP Client. They share the same connection management, the same non-blocking I/O model. The client can be used to benchmark the server with real HTTP traffic without any external tool.

# 2. Import Linter (bootgly lint imports)

A code style checker/fixer for PHP `use` statements:

* Detects missing imports, wrong order (const → function → class), backslash-prefixed FQN in body
* Auto-fix mode (`--fix`) with `php -l` validation before writing
* Dry-run mode
* AI-friendly JSON output for CI integration
* Handles comma-separated `use`, multi-namespace files, local function tracking (avoids false positives)

Built on `token_get_all()` — no nikic/php-parser dependency.

# Benchmarks (self-tested, WSL2, Ryzen 9 3900X, 12 workers)

*Numbers below reflect* [*v0.13.1-beta*](https://github.com/bootgly/bootgly/releases/tag/v0.13.1-beta)*, a patch release with HTTP Client hot-path optimizations (+29.6% throughput) and cache isolation tests.*

Scenario: 1 static route (Response is 'Hello, World!'), 514 concurrent connections, 10s duration.

|Runner|Req/s|Latency|Transfer/s|
|:-|:-|:-|:-|
|**Bootgly TCP\_Client\_CLI**|**629,842**|553μs|81.69 MB/s|
|**WRK** (C tool)|**595,370**|—|—|
|**Bootgly HTTP\_Client\_CLI**|**568,058**|1.07ms|56.95 MB/s|

Three different benchmark runners, all built-in (except wrk). The TCP client sends raw pre-built HTTP packets — that's the theoretical ceiling. The HTTP client builds and parses real HTTP requests/responses with full RFC compliance — that's the realistic throughput. WRK sits in between. All three confirm the server sustains **568k–630k req/s** on a single machine with pure PHP + OPcache/JIT.

To provide context: [Workman at TechEmpower Round 23](https://www.techempower.com/benchmarks/#section=data-r23&test=plaintext&l=zik073-pa7) — the fastest pure PHP framework there — achieved approximately 580,000 requests per second on dedicated hardware. Bootgly reaches that level, with a difference of about 3% (a technical tie).

Why this absurd performance?

I tried replacing `stream_select` with `libev` or `libuv` and it got worse — the bottleneck is in the C ↔️ PHP bridge, not in the syscall.

The C → PHP callback dispatch via `zend_call_function()` is approximately 50% more expensive than a direct PHP method call. Many people don't know this, but `stream_select`
has absurd performance and the call is 50% faster than a C ↔️ PHP bridge.

# Stats

* 37 commits, 467 files changed, +13,426 / −3,996 lines
* PHPStan level 9 — 0 errors
* 331 test cases passing (using Bootgly's own test framework, not PHPUnit)

# The "why should I care" part

I know r/PHP sees a lot of "my framework" posts. Here's what makes Bootgly different from Yet Another Framework:

1. **Zero third-party deps in core.** The vendor folder in production has exactly one package: Bootgly itself. This isn't ideological — it means the HTTP server boots in \~2ms and the entire framework loads in a single autoboot.php.
2. **I2P architecture (Interface-to-Platform).** Six layers (ABI → ACI → ADI → API → CLI → WPI) with strict one-way dependency. CLI creates the Console platform, WPI creates the Web platform. Each layer can only depend on layers below it. This is enforced by convention and static analysis, not by DI magic.
3. **One-way policy.** There is exactly one HTTP server, one router, one test framework, one autoloader. No "pick your adapter" indirection. This makes the codebase smaller and easier to audit.
4. **Built for PHP 8.4.** Property hooks, typed properties everywhere, enums, fibers-ready. No PHP 7 compatibility baggage.

It's still beta — not production-ready. But if you're tired of frameworks where `composer install` downloads 200 packages to serve a JSON response, take a look.

GitHub: [https://github.com/bootgly/bootgly](https://github.com/bootgly/bootgly)
Release: [https://github.com/bootgly/bootgly/releases/tag/v0.13.0-beta](https://github.com/bootgly/bootgly/releases/tag/v0.13.0-beta)
Patch: [https://github.com/bootgly/bootgly/releases/tag/v0.13.1-beta](https://github.com/bootgly/bootgly/releases/tag/v0.13.1-beta)

Happy to answer questions and take criticism.

https://redd.it/1slnw50
@r_php
Is Claude my permanent co-author?

I wanted to migrate an old PHP web app that I wrote by hand to a modern framework, and chose Symfony. I prepared some docs, watched some symfony youtubes, and resisted getting started for months. Finally, I decided to see if Claude code could get me over the hump. Well, I'm astounded by the result. Completely rebuilt in a solid Symfony framework in about 10 days. Works beautifully. I had claude build documentation as well, but now I have a site whose internal wiring is really beyond my ability to manage responsibly. I can invoke Claude in the code base, and pick up work at any time, but I couldn't maintain the system without Claude. I feel peculiar about it now: I'm the (human) author but I have an AI partner that has to be part of the "team" going forward. I can't be the first person to get here. Any words of advice?

https://redd.it/1slxyp7
@r_php
How I evolved a PHP payment model from one table to DDD — channels, state machines, and hexagonal architecture

I got tired of every project reinventing the payment layer from scratch, so I tried to build a proper domain model in PHP and document the process.

Wrote about going from a single table to channels, state machines, and hexagonal architecture.

It's an experiment, not a final answer — curious how others tackle this.

https://corner4.dev/reinventing-payment-how-i-evolved-a-domain-model-from-one-table-to-ddd

https://redd.it/1sm3f80
@r_php
Anyone else get tired of rebuilding Filament resources every time admin requirements change?

I kept hitting the same pattern in Laravel / Filament projects:

the first version of the admin panel is usually fine, but later the data side keeps changing.

New content type.
More custom fields.
Better filtering.
Dashboards.
API requirements.
Tenant-specific behavior.
More exceptions.

At that point, every "small" change becomes another migration, another model, another Filament resource, and another layer of maintenance.

So I built a plugin called **Filament Studio** for Filament v5.

The idea is to let you create collections and fields at runtime, manage records through generated Filament UI, build dashboards, add advanced filtering, and expose APIs without rebuilding a brand-new schema layer every time requirements shift.

It also includes things I thought were important if this is going to be useful beyond a demo:

\- authorization
\- multi-tenancy
\- versioning
\- soft deletes
\- custom field and panel extensibility

I know some people will immediately look at the EAV angle and prefer hand-built resources anyway, which is fair.

I am mostly curious about where other Laravel developers draw that line.

If you are building something with a stable schema, I still think hand-built resources make sense.

But if the admin/data model changes constantly, would you rather keep building each resource manually, or use something like this?

Repo if you want to look at it:

GitHub: https://github.com/flexpik/filament-studio

I am not looking for empty promotion here. I would rather hear the real objections or the kinds of projects where this would actually help.

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