r/PHP • • 6h ago

Article Laravel Rust vs PHP: is PHP the bottleneck?

Thumbnail rapira.rs
87 Upvotes

Follow-up to this thread, same setup (1 vCPU per container, Chirper traffic mix). This time the ramp goes up to 5k RPS instead of 2k.

In the original comparison Laravel ran on FrankenPHP and Symfony on Swoole, so the frameworks and the app servers changed at the same time. We added both frameworks on one common base, Rapira. That lets us compare the frameworks on the same app server, and then the same frameworks on different app servers and on Rust.

  • On the same app server, Laravel tops out at about 190 RPS and Symfony at about 2,900 RPS. The bottleneck is the framework and its abstractions, not PHP.
  • Above 2k RPS both Symfony setups beat Laravel Rust: 3,430 (Swoole) and 2,913 (Rapira) RPS vs 2,638.
  • Caddy in front of laravel-rust on 1 vCPU cost 27% of its throughput.

Takeaways

  1. Profile the framework before rewriting in another language. On this API PHP was not the bottleneck. Switching the app server mostly cut memory and errors under load, not RPS.
  2. Fit the data layer to the endpoint: fewer queries and no full model hydration where you don't need it.
  3. Compare runtimes on tail latency, errors under overload and memory, not on a single RPS number.

r/PHP • • 18h ago

Article Laravel Rust is Here

Thumbnail laravel.com
68 Upvotes

r/PHP • • 15h ago

Laravel Rust vs Symfony PHP: results from the same benchmark workload

Thumbnail x.com
31 Upvotes

r/PHP • • 47m ago

Update: PHP on a microcontroller grew up and got a composer.json (php-esp32-sdk 2.0)

Thumbnail php-baremetal.com
9 Upvotes

Some of you may have seen php-baremetal before: the project that cross-compiles the actual Zend engine onto ESP32 chips, on a board that costs less than 5$. Not a subset, not a transpiler. Your index.php is the firmware.

Today it hit 2.0,

What changed

  • TOML config become composer.json**.** In 1.x a project was configured with a TOML file. Now it's a normal Composer project. The board, runtime and storage go under extra.baremetal, and config.platform.php is no longer a polite suggestion: it's the PHP version compiled into the chip.
  • "Enable GPIO in the config" become composer require php-baremetal/ext-gpio**.** Every hardware feature is a package now: GPIO, I2C, SPI, Wi-Fi, HTTP/WebSocket, LED strips, displays, touch. PHP's own extensions too (mbstring, pdo_sqlite, opcache…). Don't need Wi-Fi? Then the firmware doesn't compile Wi-Fi.
  • A separate binary become phpbm. The new CLI is written in PHP (of course) and does init, build, flash, sync and monitor. It downloads the SDK as a versioned, sha256-checked archive. composer.lock and phpbm.lock mean "works on my board" now also works on yours.
  • PHP 8.6.0 added, next to 8.3, 8.4 and 8.5. Yes, the microcontroller is on a newer PHP than half the servers out there.
  • And an infinite number of other things .....,I don't want to bore you by listing them all

What didn't change

  • Blink is still your lines of real PHP:
function setup(): void { gpio_mode(2, GPIO_OUTPUT); }
function loop(int $tick): void { gpio_write(2, $tick % 2); delay(500); }

Small things that make me happy

  • Your IDE autocompletes gpio_write(), because every package ships stubs.
  • Boards can name their pins, so Pin::LED_BUILTIN works on the Arduino Nano ESP32 and the Seeed XIAO ESP32-S3.
  • Out-of-memory is now a proper fatal error with file and line, instead of the board quietly rebooting and pretending nothing happened.

No board? The browser simulator (https://sim.php-baremetal.com, built on Velxio) builds your project with phpbm and runs it on an emulated ESP32-S3. Zero soldering.

Custom composer Registry : https://repository.php-baremetal.com/ with all available package

Full write-up, with way too many diagrams: https://www.php-baremetal.com/blog/php-esp32-sdk-2-composer-firmware

MIT licensed. Question for you: does "a hardware feature is a package" feel natural to you, or did we just invent a very small dependency hell?


r/PHP • • 4h ago

Agent Skills in PHP: On-Demand Skills for Neuron AI Agents

0 Upvotes

Alessandro, a friend of Neuron AI gifted the community with this amazing package. After a but of work together I decided to host it under the offical Neuron github organization.

I think it's the better implementation across the agentic frameworks in any stack. It allows you to store skills in different storage layers not only the filesystem, such as a database. You can even implement your custom storage like S3 for example just implementing the package interface.

This is amazing because it fits web application archtiectures where you could need to store skills in the way your application wants to offer this feature to the users or for your own convenience. With this abstraction your agent doesn't care where skills physically are.

This is what PHP needs I think. Thank you Alessandro.

https://www.neuron-ai.dev/blog/agent-skills-in-php-on-demand-skills-for-neuron-ai-agents/