r/PHP • • 5d ago

Weekly help thread

5 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 • • 16d ago

Who's hiring/looking

19 Upvotes

This is a bi-monthly thread aimed to connect PHP companies and developers who are hiring or looking for a job.

Rules

  • No recruiters
  • Don't share any personal info like email addresses or phone numbers in this thread. Contact each other via DM to get in touch
  • If you're hiring: don't just link to an external website, take the time to describe what you're looking for in the thread.
  • If you're looking: feel free to share your portfolio, GitHub, … as well. Keep into account the personal information rule, so don't just share your CV and be done with it.

r/PHP • • 2h ago

Laravel Rust is 18x faster at solving a problem you don't have

Thumbnail reddit.com
17 Upvotes

r/PHP • • 1h ago

What we've shipped in Leaf since 5.0: FrankenPHP worker mode, PHP 8.6, agent-friendly defaults

2 Upvotes

Hi folks!!! Leaf maintainer here. Some of you might remember Leaf 5 which we shipped in August, our take on modularised and lightweight PHP without sacrificing all the goodies you get in other batteries-included frameworks.

There's a full post on all the stuff we've done since then at blog.leafphp.dev/posts/fastest-way-to-build, but I wanted to share a brief here.

- We introduced a new version of our Eien server which is now based on Franken PHP
- Better PHP 8.6 support
- Clearer instructions for agents on how to write better code
- Some upcoming products to help folks build faster

Leaf is at about 822,000 installs across the whole ecosystem, free and open source, run by a very small team. We'd love you to give it a try, whether you're writing code yourself or using an agent. Happy to answer anything, and if you try Eien and the numbers do not hold up on your setup, I would genuinely like to hear it.


r/PHP • • 10h ago

i built a php extension for prometheus metrics

3 Upvotes

hey guys, i have built an extension that exposes some main metrics about your app's functions and entrypoints and right now i need your test and feedback so we can make it more mature together.
https://github.com/hatam-abolghasemi/php-prometheus-extension

briefly if i have to explain what my mindset and intention was for creating it, it's like there is no php-exporter anywhere and traces and APMs are expensive to have and so what if we can make something in between? it's not basically an exporter, it's not a profiler neither. it's just a wrapper around functions and it's tried to be built as lightweight as possible. that's it. test and give me feedback please.

thanks in advance


r/PHP • • 1d ago

Discussion Follow-up to the PHP2Shell version count from October: two weeks after the fix, 96% of sites on managed hosts showed a fixed version, 23% on cloud servers

26 Upvotes

I work at IPinfo. In October I posted the version count from before the PHP2Shell fix. After that we rescanned the same addresses every day for two weeks after the October 21 release.

  • 87,865 live sites on 8.2–8.5 that didn't show a fixed version on October 22
  • Five networks run by hosting companies that update PHP for their customers: 95.6% fixed after two days, 96.4% after two weeks
  • Cloud servers at four big providers, where the owner runs updates: 12.5% after two days, 22.7% after two weeks. Each provider ended between 21% and 24%
  • Across the 395 networks with at least 20 of these sites, the median was 32%
  • On 5.4–8.1 (source patch only, or no fix): 2.8% of 265,141 sites moved to a fixed version

What we can't see: distro backports that keep the version number. We left out versions with a distribution tag; only 2% of the cloud sites ran a stock Ubuntu version. Red Hat-family Linux and Amazon Linux shipped new version numbers, so they're counted. Every share is a minimum.

Two-thirds of the cloud sites that didn't move were already four or more releases behind on October 22.

If you run PHP on your own server: what stops you from updating the day a fix comes out?

Full write-up with the method: https://ipinfo.io/blog/security-patch-adoption-managed-hosting-cloud


r/PHP • • 7h ago

Web UI for the Laravel and Symfony scheduler, every run with its output and exit code

Thumbnail youtube.com
0 Upvotes

the usual setup is one * * * * * php artisan schedule:run line in crontab. works fine, until you want to know what a task did last night. output goes to /dev/null by default, and if it threw, the stack trace is somewhere in laravel.log between everything else.

so i made runwisp/runwisp. it runs the schedule you already have and keeps every run in a web UI: what it printed, the exit code, how long it took, and the exception if it threw.

composer require runwisp/runwisp
php artisan runwisp:work

that replaces the cron line. routes/console.php stays as it is.

on Symfony it's bin/console runwisp:work, your #[AsCronTask] and #[AsPeriodicTask] work as they are and messenger:consume scheduler_default can go.

few things r/PHP might care about:

  1. every run is its own php artisan runwisp:run <task> process. a command that leaks memory can't take the next run down with it, and Stop in the UI kills the actual process.
  2. when when(), between(), maintenance mode or withoutOverlapping() skips a run, it shows up as skipped with the reason, like the when() at routes/console.php:10 returned false. a streak of skips folds into one row so it doesn't flood the history.
  3. your queue worker can run under it too and gets restarted when it exits. so Supervisor can go as well.
  4. runwisp:check lists every task with its next run and validates the config. it exits with 1 on a mistake, so you can put it in CI. after a deploy runwisp:reload picks up the new schedule and running tasks keep going.
  5. each run happens once per data directory, however many workers you start. you don't need onOneServer().
  6. #[RunWisp\Task(retry_attempts: 3, timeout: '10m')] on a command or job adds retries, timeouts and Slack/Telegram alerts. the options are PHPStan array shapes generated from the config's JSON schema, so a typo fails phpstan (and runwisp:check too).

under the hood it's one Go binary with the scheduler, process supervisor, SQLite and the UI embedded. the composer plugin downloads it for you. no Redis, no extra DB, no Node. CodeIgniter 4 and plain PHP scripts work too.

Laravel 11 to 13, Symfony 6.4+, PHP 8.2+.

https://github.com/runwisp/runwisp

https://docs.runwisp.com/sdk/php/laravel/

https://docs.runwisp.com/sdk/php/symfony/

what does your schedule run on right now? curious what i'm actually replacing :)


r/PHP • • 1d ago

I am new here

123 Upvotes

I'm 78.

Retired 16 years ago.

I have spent the last week rewriting an old php7.4 app so it runs under (is written with) php8.4......my protect is an ancient files based cms called Robopages.

< 10,000 lines of code but it does a lot.

Once I get that ironed out l will work on an update to a php 8.6 server. The upgrade to 8.4 was mostly about better coding practices (initialize everything and always check for NULL).

XML handling did change , from way back when.

Does the upgrade from 8.4 to 8.6 require coding changes? (I do a lot with SimpleXmlElements) ...which did change considerably from 7.4

Or does 8.6 exist mostly as a way of introducing hotrod new features?


r/PHP • • 2d ago

Discussion Partial function application in PHP 8.6 is such a redundant feature (unpopular opinion)

60 Upvotes

PHP 8.6 adds a feature called partial function application. Here's how it works:

$foo = str_replace(?, 'x', ?);
$bar = $foo('a', 'aloha'); // xlohx

I'm not a fan of this feature, as it's just a confusing syntax sugar. Consider this example:

$value1 = str_replace('a', 'x', 'aloha');
$value2 = str_replace(?, 'x', ?);

What looks like two instructions of the same kind, is actually two completely different things. They use the same structure, but the first one returns a function and the second one returns a value. This used to be considered an anti-pattern for a long time.

The older and more experienced I get, the more I feel like adding features to programming languages often does more harm than good. Languages get bloated and harder to read with not much in return. There are some changes I like (example: null-safe features), but there are also many I don't. Partial function application is one of them.


r/PHP • • 23h ago

How I set up and run a local PHP MVC workflow from scratch using Pocket Editor and FusionPHP (full text walkthrough)

Thumbnail facebook.com
0 Upvotes

Full disclosure: I am the developer behind both Pocket Editor (a lightweight Python desktop code editor) and FusionPHP (a small PHP MVC framework). I wanted to share the exact workflow I use to spin up a new project, get live template syntax checking, and test changes locally without opening a heavy IDE.

### Prerequisites

* PHP (with the built-in CLI server)

* Git

* Pocket Editor (`pipx install pocket-editor` or from source at https://github.com/somidouth-collab/pocket-editor)

### 1. Select a Workspace Directory

Open Pocket Editor, go to the **Project Explorer** on the left sidebar, click the folder icon, and select your parent workspace folder (for example, `Projects/tuto`).

### 2. Clone the Starter Project via Built-In Git

Instead of dropping to a separate terminal to clone the repo:

  1. Switch to the **Git** tab on the left panel.
  2. Paste the repository's HTTPS URL into the **Remote URL** field and click **Clone**.
  3. Confirm the parent directory and name the new folder `lesson_one`.

Once cloned, the directory layout populates in the explorer:

```text

lesson_one/

├── app/

│ └── views/

│ └── home.tpl

├── fusionphp/

├── plugins/

├── public/

└── tests/


r/PHP • • 1d ago

News PagibleAI CMS 0.14: multilingual pages, 5 CMS importers, 17 new themes

0 Upvotes

I maintain PagibleAI CMS, and 0.14 is out. It's a full-featured, MIT-licensed CMS that you add to any existing Laravel 11–13 app (PHP 8.2+) with:

composer req aimeos/pagible

You get a page tree, structured content elements, drafts with full history and a Vue admin for editors. Your frontend reads content through JSON:API, the Blade themes or Eloquent models. It's a finished CMS rather than an admin toolkit, and everything lives in your database next to your own models.

The AI parts (writing, translation, images, an MCP server for agents) are optional and stay off until you add API keys - or can be skipped totally in custom distributions.

Languages

Most of the work in this release went into languages. In 0.13 and earlier, a translation was a separate page linked to the original. Now a page is a single tree node with one variant per language. Each variant has its own URL, drafts and publish date, and when you move a page, all its languages move with it.

Reading a page in a regional language falls back along a chain:

use Aimeos\Cms\Models\PageView;
    
$page = PageView::live($request->user(), 'de-CH')
    ->where('path', 'what-is-pagibleai')
    ->firstOrFail();
    
$page->lang; // "de" if there's no Swiss German variant, else the source language

de-CH falls back to de by default, and you can define your own chains in the config, e.g. 'lb' => ['de', 'fr']. The fallback is resolved in SQL: a derived table left-joins one variant row per language in the chain and picks the first match, so nothing gets loaded and filtered in PHP. Pages also send hreflang links and a Content-Language header.

Editors see which translations are outdated after the source page changes. Translate sends only the changed elements to DeepL or an LLM and saves the result as a draft. cms:user --langs=fr limits a translator to the French variants.

Importers

There are new importers for Drupal 7/8+, Joomla 3–5 and Statamic, with the WordPress and TYPO3 importers were mostly rewritten. They read the old database through a regular Laravel connection and bring over the page tree, redirects and SEO metadata. Translations end up as variants of their original page, not as separate pages. WordPress has no built-in translations, so that doesn't apply there.

php artisan cms:joomla-import --connection=joomla --dry-run

All importers accept --since=2026-11-01 to import only content changed since that date. That lets you keep the old site running while you build the new one and sync the changes before switching over. They're still beta, and every old CMS database has its own quirks. If one fails on your data, an issue with the error message helps me most.

Themes

There are 28 themes now, most of them for specific businesses like plumbers, electricians, builders, doctors, law firms, restaurants and salons, plus SaaS, documentation and portfolio sites. All of them come with demo content. Each theme is its own Composer package based on Pico CSS variables and shared Blade components, so restyling one mostly means changing tokens.

Available themes: https://pagible.com/themes

Upgrade

This is a breaking upgrade. The migration turns every existing page into the source variant of itself. Translations that were linked as separate pages in 0.13 stay separate, and you have to merge them yourself. The PHP API, GraphQL, MCP and JSON:API changed too, and everything is listed in the upgrade guide.

If you like PagibleAI, give it a star on Github :-)


r/PHP • • 1d ago

How to get alerted when your Laravel scheduled tasks don't run

Thumbnail watchgoose.com
0 Upvotes

Hi all,

Sharing this here because I think others might find it useful too. I've seen clients run into the following. Say your Laravel app sends invoices every night at 2:00, if that task doesn't run, Laravel then won't tell you. Since nothing runs, nothing seems to have failed. You then only find out when a customer asks where their invoice is.

I made my own fix for this by letting something outside your server notice (basically a heartbeat monitor). It works by, when affter the task succeeds, it pings a URL. If it doesn't come, you get an email or a Slack message, so you can fix it before your customers notice.

My heartbeat monitor is called Watchgoose, and it's free to use for up to 10 checks. I also made a Laravel guide, which you can find in the link i shared!!


r/PHP • • 2d ago

Standard identifiers for PHP

Thumbnail php-stdnum.org
17 Upvotes

I've released php-stdnum, an MIT-licensed PHP library for working with standardized identifiers.

The initial release includes:

  • 606 validators covering VAT numbers, tax identifiers, IBANs, national identifiers, company registration numbers, ISBNs, postal codes and more.
  • 594 native deterministic test-data generators.
  • Validation, normalization, formatting and scoped detection.
  • Immutable value objects and typed validation errors.
  • Optional Laravel, Symfony, Doctrine and FakerPHP integrations.
  • PHP 8.3–8.6 compatibility.

Documentation: https://php-stdnum.org/

GitHub: https://github.com/php-stdnum/php-stdnum

I'd appreciate technical feedback. Thank you!


r/PHP • • 1d ago

Article Laravel Best Practices: Clean Code and Architecture

Thumbnail codyssey.dev
0 Upvotes

Hey all,

I wrote a course about the bad habits that make Laravel codebases hard to change, work with as well as slower as the complexity grows over time in long-term applications.

The examples are specific to Laravel but they can also be applied to any other PHP application as well with the framework-equivalent approach.

I’ve made some of these mistakes myself as well as I’ve seen them in different projects of different sizes I worked on over the years so the list does come from experience.

The story and the examples are fictional but the habits are based on a true story.

Let me know what you think and if you find anything out of the ordinary in the text, readability or examples.

Thanks!


r/PHP • • 2d ago

Discussion Do I have code bias?

5 Upvotes

I know that code bias is a thing in programming, and I am always going to prefer my way of coding but I don't know whether the code I work with from our other developer is actually bad or whether I'm just being hit with code bias.

I have only ever worked with one other developers code, that hasn't already been obfuscated. Because of this, I have no baseline to know what the average code looks like.

Does anyone have any public projects I'm able to explore so I can find out if I do actually have code bias in these situations or whether there is something overly complex about the code the other developer is writing.

FYI. For some context I've learned that the other developer was originally a designer but has learnt to code. I do believe this may be a reason that we both work problems differently.


r/PHP • • 2d ago

Speed Demon II: an online race to make PHP fast with the OPcache JIT off (29 Jan to 1 Feb)

9 Upvotes

I organise this one (Hackathon Raptors, a UK nonprofit), so take it as an announcement.

Speed Demon II is an optimisation race in 26 slow languages, and PHP is one of them. The rules for PHP: the Zend VM with the OPcache JIT off, no C extensions. Whatever speed you get comes from the PHP code.

The four tasks are log aggregation (310k lines, p50/p95/p99 per endpoint and hour), a search index with 5k queries, a join over a hostile CSV, and shortest paths on a 500k-edge graph. Every entry is timed against a naive version in the same language, so PHP competes with PHP, not with C. One machine runs every entry, one run at a time.

Free, teams of 1 to 4, $2,000 in prizes. Each push sets the speed of your team's car in a live 3D race around San Francisco: https://speeddemon.dev/2027/img/r-start-1920.jpg

Site: https://speeddemon.dev/2027/


r/PHP • • 1d ago

The 100 PHP functions in 2026

Thumbnail exakat.io
0 Upvotes

The most commonly used PHP native functions, from the 2026 dataset.

Can you guess which is the most used function?


r/PHP • • 2d ago

Laravel COBOL Demo

Thumbnail cobol.laravel.cloud
17 Upvotes

r/PHP • • 3d ago

Laravel's move into Rust got me thinking...

120 Upvotes

It reminded me of all the times Taylor and some of his most vocal supporters (especially those who work with him) mocked developers who advocated for stricter code and better coding practices within Laravel. And what do they do now? They embrace one of the strictest programming languages out there. Oh, the irony.

I'm not denying Rust's performance advantages, but I find it hard to believe that performance alone was the driving force behind this decision, especially considering the needs of most web applications.

To me, this looks more like a strategic business pivot aimed at expanding Laravel Cloud's market share and establishing a stronger source of recurring revenue.

After all, deploying a PHP-based Laravel application is incredibly easy these days. You can deploy it on cheap shared hosting, a $5 VPS, a traditional LAMP stack, a Docker container, or virtually any hosting provider that supports PHP. The ecosystem is mature, affordable, widely available, and doesn't tie you to any specific infrastructure provider.

For many small to medium-sized projects, Laravel Cloud offers convenience rather than solving an actual infrastructure problem. With Laravel Rust, however, they have an opportunity to capture a larger share of the hosting market. Many developers coming from PHP who are unfamiliar with deploying Rust applications may naturally gravitate toward Laravel Cloud. From a business perspective, it makes perfect sense.

They've also assured everyone that they won't abandon the PHP version, but I'm highly skeptical of that promise. I wouldn't be surprised if, a few years down the road, the PHP version gradually gets sidelined and eventually abandoned, followed by Taylor's loyal followers gaslighting anyone who reminds them of what was originally promised.

I just hope they don't bring the same culture of framework lock-in to the Rust ecosystem, where otherwise generic libraries gradually become framework-specific packages. (Hey, Spatie, I haven't forgotten what you did with your `data-transfer-object` package.)


r/PHP • • 2d ago

Discussion PHP Engine in Go or Rust instead of C

22 Upvotes

I've considered a couple of times making an April Fool's announcement of this, but the recent Laravel discussions got me to thinking - what would be the tradeoffs. Would the engine run faster? Would it be worth it?


r/PHP • • 2d ago

The cost of Rust

81 Upvotes

I know Rust pretty well. I did a partial-port, partial-rewrite of a big PHP project into Rust by hand. I've ported two more big systems for Rust using LLMs — one, a toy port of Psalm, and the other a port (playground here) of an 300k-line OCaml typechecker to Rust, which we use in CI at $company.

In all the production uses, the equation was:

benefit = production_savings - development_cost

production_savings = frequency_of_use * cpu_seconds_saved
development_cost = initial_port_cost + frequency_of_updates * seconds_waiting_for_rustc

cpu_seconds_saved: The ported projects were not typical of PHP workloads. They were all massively-CPU-bound, never waiting on a database or memcache, with high frequency use and provably-massive improvements in cpu_seconds_save per execution.

initial_port_cost is undoubtedly cheaper now with LLMs, but not free. Rewriting a large project in Rust by hand used to cost an expensive man-year. Today, porting a 300k-line typechecker cost in the mid-thousands of dollars, token-wise. That port relied on the upstream project's extremely comprehensive acceptance tests.

cpu_seconds_saved is the most important thing to determine before any Rust port. Unless your PHP site is very unusual, it's usually not going to be the biggest deal in the lifetime of any given request.

seconds_waiting_for_rustc we don't run rustc as part of any production deployment for our 15-million-LOC Hack codebase. It makes programs fast, but it is not fast. If your PHP project is > 100KLOC, prepare for a bit of pain.

I think it's really important to remember that your customers do not care about Rust or PHP. They just want to buy some shit on your site, or see what their local team is doing, or whatever. Rust is almost certainly overkill for that, unless you're serving millions of requests a day.


r/PHP • • 3d ago

Article Laravel Rust vs PHP: is PHP the bottleneck?

Thumbnail rapira.rs
143 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 • • 1d ago

Discussion Laravel Go and Rust are not ready

Thumbnail reddit.com
0 Upvotes

r/PHP • • 3d ago

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

Thumbnail php-baremetal.com
28 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?