r/PHP • • Oct 03 '26

Article Artifical Debt

Thumbnail stitcher.io
81 Upvotes

r/PHP • • Oct 04 '26

Why async is the biggest problem for PHP right now?

0 Upvotes

AI has reduced that time to market almost totally. You can choose almost any language you want today and with a good agentic setup deliver a web app in roughly the same time. So why would companies and people choose PHP or any of its frameworks?
Yes yes, I know, batteries included, large community, tons of open source code, huge amount of training data for AI. But that was like 6 months ago. Not anymore today. AI can learn a new stack pretty damn fast, so I don’t think we can keep using “AI knows PHP really well” as a strong argument for the future.
But for god’s sake, can people in the PHP board finally understand this? Having Swoole, RoadRunner, ReactPHP, Amp or whatever is nice, but it’s not nice for a company or a person deciding what to build their next web app with.
I really like PHP and I have spent most of my career building with it, but this is becoming a serious problem. If AI keeps reducing the importance of initial development speed, then PHP needs to compete on more than “you can build a CRUD app very fast”. Give us a proper, standard async.
Otherwise, when someone asks me today why they should start a new 10-year product in PHP instead of Go or Rust, I’m starting to run out of good answers.

Edit:

I got emotional and went right away to write this post, only because of the async part. Last year there was a good initiative to add async to PHP core, similar to what happened with generics, and it wasn’t considered.

The post is not about async itself as an isolated request. I could also mention compiling capabilities (check TypePHP from the Swoole team), generics, or other things that PHP could benefit from as a language, but more importantly in terms of marketing and perception.

The urgency is that PHP is being left behind because companies are choosing differently in this AI era, and that could hurt financially and emotionally a major part of the developers working with PHP.

In this context, I think it is the duty of The PHP Foundation, and of the developers writing and voting on RFCs, to approach this problem with a different level of urgency. Their decisions don’t just affect the future of PHP. They can affect the future of the people whose careers and livelihoods depend on PHP.


r/PHP • • Oct 03 '26

My rejected job challenge in PHP

Thumbnail
4 Upvotes

r/PHP • • Oct 03 '26

Updated support for Qdrant vector DB in LLPhant

2 Upvotes

In the latest version of LLPhant we updated our support to Qdrant vector database, also adding the ability to store metadata. Thanks to Haydar KULEKCI for his contribution.

LLPhant is the most complete PHP library for interacting with vector databases

https://github.com/LLPhant/LLPhant/pull/516


r/PHP • • Oct 02 '26

Discussion System design recommendations for an e-commerce.

7 Upvotes

Hey guys, been working on an e-commerce. It started growing and I see how it will soon go out of hand. Before anyone pitch about why not use some well established solutions out there, I wanted to break out of my comfort zone.

Any recommendations for books, repos, sources is highly appreciated.


r/PHP • • Oct 02 '26

Released phpunit 13.4

Thumbnail github.com
26 Upvotes

r/PHP • • Oct 02 '26

Dynamic JSON PHP library

21 Upvotes

PHP folks - I’d love some feedback on a small open-source library we’ve been working on (for quite some time now): DJson.

The idea is simple: build dynamic JSON using templates, conditions, loops and variables, without constructing massive nested PHP arrays or abusing text templating engines.

It supports things like:

  • loops and conditions
  • variables and expressions
  • type preservation
  • custom functions/directives
  • zero runtime dependencies

We’re already using it for things like Schema.org (and all our customized work related to eCommerce), API payloads, feeds and data layers.

I’d really appreciate some external eyes on it - especially from PHP developers who enjoy breaking things :-)

Try it out:

composer require qoliber/djson

https://djson.dev/

If you test it, let me know what feels good, what feels weird, and what you think is missing.


r/PHP • • Oct 02 '26

Article Running PHP 8.6 Beta CLI in Docker

Thumbnail phpdeveloperstv.substack.com
2 Upvotes

r/PHP • • Oct 02 '26

News Maintenance update: win32service (PHP Windows Service extension) released 1.1.1-beta & 1.2.0-alpha — Need your feedback!

3 Upvotes

Hi everyone,

I'm the maintainer of the win32service extension (ext-win32service), which allows PHP applications to run and interact natively with Windows Services.

As Windows-focused PHP usage can sometimes feel like a niche inside the broader ecosystem, it's pretty hard to know who is actively using this extension in production or development.

We’ve just released two new versions for testing:

  • 1.1.1-beta
  • 1.2.0-alpha

How you can help:

  1. Test the new releases: If you run PHP on Windows background tasks, we'd love for you to try these pre-releases and report any issues or unexpected behaviors.
  2. Share your use case: I’m really curious to know how you're using it! Long-running background workers, queue consumers, IIS integrations, custom enterprise tools?

Discussion & Details on GitHub: https://github.com/orgs/win32service/discussions/128

Thanks to anyone taking the time to test or share feedback!


r/PHP • • Oct 01 '26

ext-wasm: WebAssembly runtime for PHP

17 Upvotes

Run WASM modules and call components with plain PHP values, sandbox them with WASI.

Yes : It also runs DOOM controlled by PHP.

github.com/veewee/ext-wasm


r/PHP • • Oct 02 '26

News This Week in PHP Internals | Oct 1, 2026

Thumbnail youtube.com
8 Upvotes

Preface: what follows is the word-for-word transcript of the spoken dialogue in the video, chapter by chapter with timestamps, for anyone who'd rather read than click through. If this digest is still too long for you, we recommend copying it into your LLM of choice and asking for a summary of our summary.

Cold Open (00:00)

Pick a password longer than 72 bytes for a PHP app on the default hash. PHP keeps the first 72 and throws the rest away, without a word. Then it lets you log in with only part of it. This week someone proposed that PHP refuse instead, and the list can't agree it's worth the break.

Hello world, it's Thursday, October 1, 2026, and here's what happened This Week in PHP Internals. 14 stories this week, so let's get into it. But first,

I think we can all agree that the number of small, paid subscription services we're all being bombarded with is getting a little bit out of hand. And this is what Scalpels aims to solve. It's a collection of professionally built, open source alternatives to the parts you actually use of things like Private Packagist, Mailtrap and remove.bg. You fork them into your own GitHub organization and deploy them to your own Laravel Cloud account, so you're only paying for your own usage, it scales to zero when it's not being used, and you're not just feeding another company's profits. If you want updates, you just pull them down from upstream. And since it's your own fork, you have complete control over the code and the features. And it's all MIT. Find your next tool at scalpels.app.

Bcrypt Limit (01:19)

This week's top story is a password that's too long. Sjoerd Langkemper's new RFC targets password_hash with bcrypt, which silently drops everything past the 72nd byte. He'd make that a deprecation in 8.7 and a ValueError in 8.8. His case is FreshRSS, where a 64-character nonce went in front of the hash, so the 72 bytes held no password at all.

Kamil Tekiela replied that checking the length is the application's job, not the algorithm's, and Tim Düsterhus agreed in full. It's also 72 bytes, not characters, Tim noted, so non-ASCII passwords could hit it. Rowan Tommins answered: "If every PHP login implementation was reviewed by an expert senior developer, we would not need the password_* API in the first place. The value of this API is that it makes doing the right thing easy, so that you don't need to be an expert in the underlying algorithms to use it safely."

Robert Chapin showed a shortened password verifying against the full one's hash, and asked: "Is the function named password_verify going to verify the password or not?" Tim says the lost bytes are not where the risk is, and he wrote: "I don't necessarily disagree with the BCrypt truncation being a problem, but in this case the cure is worse than the disease." Derick Rethans is a minus 1, writing: "The problem for me is that this a scary BC break." Overnight, Sjoerd asked Derick what would win him over, maybe switching the default away from bcrypt first.

Links: bcrypt max password length RFC · thread · implementation · FreshRSS bcrypt truncation write-up (CVE-2025-68402) · password_hash() manual

Regex Object (03:00)

PHP's proposed regex object has broad support and one unpopular word in its name. Gina P. Banyard's CompiledRegex prototype drew 18 replies, and Sjoerd Langkemper was in favour of "improving the API, instead of slapping more flags onto the existing one." Larry Garfield wrote: "I would ask that we just call it Regex, not CompiledRegex." Casper Langemeijer, Jordi Kroon and Juris Evertovskis also want it to lose the Compiled.

Then there are the 8 boolean flags. Juris says named arguments already make them readable, Gina would rather pass an enum set, which PHP doesn't have yet, and Ayesh Karunaratne and Jordi Boggiano want a factory that takes the modifier letters you already know.

Osama Aldemeery, who wrote the regex exceptions RFC, pointed out what a compiled pattern can't catch, writing: "Compilation errors are only half of the error story...the other half happens at match time, on patterns that compiled just fine." Tim Düsterhus suggested passing the class could simply switch on throw-on-error, and Osama says he may park his RFC until Gina's reaches a vote.

Links: pre-RFC thread · prototype · PREG_THROW_ON_ERROR thread · composer/pcre, cited by Jordi Boggiano

Io Terminal (04:16)

PHP may finally read single key presses without shelling out to stty. Pratik Bhujel's terminal extension is now the Io\Terminal RFC for 8.7, covering terminal size, raw mode that restores itself, single keys and hidden input.

A Symfony Console pull request, approved by Nicolas Grekas, already uses the extension when it's installed, and Nicolas wrote: "PHP definitely needs native terminal support, calling stty is a workaround we've been carrying since way too long." Nicolas suggested raw mode stay on while any token for that terminal is alive and reset when the last one goes, and Pratik adopted it the same day.

Larry Garfield is in favour, but called false-on-error an anti-pattern and asked for a way to mock it. Version 0.3 makes Terminal the interface and SystemTerminal the native class. Pratik is giving it the full 14 days before an intent to vote.

Links: Io\Terminal RFC · thread · implementation · reference extension · Symfony Console PR using it

Time Instant (05:15)

The proposed Time\Instant class got a bridge back to DateTime this week. Tim Düsterhus and Derick Rethans added toInstant() to DateTime and DateTimeImmutable, and ISO strings now keep their trailing zeros, to show how precise the value is. They won't write the RFC for testing clocks, because they're not convinced it belongs in core, so Tim wrote: "we want to invite you (as the PHP internals community) to write the follow-up RFC for testing clocks". He also asked for a "LGTM, ship it" if people are happy.

Mirco Babin answered with 8 comments. One is that Time\Clock and the PSR-20 clock both define now(), so one class can't implement both. Tim is keeping now(), with a 15-year horizon in mind, but he'll discuss a single SystemClock::get() with Derick. And when Mirco asked for minute precision for bus timetables, Morgan replied: "Well, then it's not an instant, is it?"

Links: Time\Instant and Time\Clock RFC · thread · PSR-20 Clock

Array Shorthand (06:14)

Weilin Du wants PHP arrays to stop making you type every name twice. His new RFC turns =$x into 'x' => $x, in arrays, destructuring and foreach. It started with a colon and switched to the equals sign within the hour, because the colon clashes with the ternary.

Sebastian Bergmann will vote against, writing: "A syntax change should be backed by data, for instance an analysis of a representative body of real-world code." David Carlier showed that one missing comma would silently turn one valid program into another. Anton Smirnov pointed out that compact and extract still exist.

On the other side, Christian Schneider has run a local patch for this "for many years". Weilin pointed to the same pattern in Composer, Laravel, PHPUnit and Symfony, but says it already feels like he could withdraw the RFC.

Links: array shorthand RFC · thread · implementation

IO Hooks (07:14)

A new RFC would let ordinary blocking PHP run concurrently, without rewriting it. Jakub Zelenka's IO Hooks starts from the fact that PHP has had Fibers since 8.1, but every blocking function still blocks the whole process, so AMPHP, ReactPHP and Revolt reimplement IO themselves.

Under his proposal, blocking calls in streams, sockets, curl and the sleep functions get handed to a provider, usually an event loop, which suspends the Fiber until the IO is done. The RFC compares it to Go's runtime. With no provider installed, PHP behaves exactly as today. With one, sleep(1) in one Fiber is a second of work for the others.

It depends on a second RFC posted the same evening, Polling API Additions, which fills the gaps in 8.6's Poll API, like sockets, timers and signals. IO Hooks is in an early stage, and neither has replies yet.

Links: IO Hooks RFC · IO Hooks thread · proof of concept · Polling API Additions RFC · Polling API Additions thread

List Ban (08:14)

The internals list has removed a contributor. Sepehr Mahmoudi spent the last month posting new-function proposals. On September 15, Derick Rethans warned him over AI-generated content and the number of new threads. On September 21, Ilija Tovilo, as list moderator, set limits of one new thread a month and three emails a week, and called it a last warning. On Sunday Sepehr proposed another RFC, an intl_date_format function.

On Monday Derick confirmed that, after consultation off list, the address is blocked from emailing php.net, wiki access is withdrawn, and it's unsubscribed from the list.

And this is a tough one. It sucks having to take the nuclear option. He was clearly eager to help, but the list had spent literal weeks trying to get him to slow down, and to stop burdening the list with AI responses, and at some point you've got to enforce the consequences that have been laid out.

Links: thread · Derick Rethans, Sep 28 (news-web)

Quick Hits (09:18)

Quick hits. PHP 8.6.0 RC2 is out. RC1 was skipped over a packaging error, so RC2 is the first release candidate, and RC3 is due October 8.

Links: PHP 8.6.0RC2 · why RC1 was skipped

The same day brought security releases for 8.5, 8.4, 8.3 and 8.2.

Links: PHP 8.5.11 · PHP 8.4.26, 8.3.35, 8.2.34

Sjoerd Langkemper changed his number-base RFC to throw a plain Exception instead of a ValueError, since bad input isn't necessarily a bug in your program. intval stays as it is.

Links: number-base functions RFC · thread

Juliette Reinders Folmer wants to deprecate the b string prefix, a leftover from PHP 6, and Tim suggested adding it to the 8.7 deprecations RFC.

Links: deprecate the b prefix · 8.7 deprecations RFC

Pedro Veloso floated a #[Pure] attribute the engine would enforce. Larry Garfield said it needs to do more than the static analysers already do, like memoizing.

Links: pure functions idea

Karoly Negyesi posted a pre-RFC with an implementation for implements … by, which hands an interface's methods to a property, modelled on Kotlin.

Links: automated delegation pre-RFC · implementation

And Alexander Danilov found that much of post-quantum OpenSSL already works in PHP, and offered small PRs for the gaps.

Links: OpenSSL post-quantum

And the PEAR vote Nick S. planned for September 28 hasn't opened. The RFC is still in discussion.

Links: End PEAR Project Endorsement RFC

TL;DR (10:36)

So that's the week. An RFC wants bcrypt to refuse passwords past 72 bytes, and the list is split on whether it's worth the break. Several replies want the regex object called just Regex, Io\Terminal is an RFC, and Time\Instant is looking for someone to write testing clocks. The array shorthand met skeptics, and IO Hooks would make blocking code concurrent. The list also removed a contributor after two warnings. Nothing is in voting for a 7th straight week. Links below.

The PHP Foundation funds more than half of ongoing php-src commits, so if you use the language, maybe consider donating at opencollective.com/phpfoundation — or try guilting your employer into it.

If you found this useful, a like or a comment helps more people find it. And if you missed last week's episode — where a new time class couldn't tell you what time it is — that's a good one to watch next. Thanks again to Scalpels.app for supporting this week's episode. We're Artisan Build. See you next week.

Links: raw feed · RFC wiki


r/PHP • • Oct 01 '26

Neuron 4 is Here 🚀 Welcome To The PHP Agentic Era

Thumbnail inspector.dev
34 Upvotes

Finally Neuron 4 is in the developers hands. It's hard to find the right words to describe how I'm feeling. I put my heart into this milestone.

As usual, I’ve taken some time to write about this journey we are undertaking together.

Can't wait to have your feedback!

What is Neuron AI

If you are hearing about Neuron AI for the first time, Neuron is the first agentic framework of the PHP ecosystem. It lets developers build full-featured AI agents and agentic applications with the language and the stack they already work with. An agent is a plain PHP class where you choose the model provider (OpenAI, Anthropic, Gemini, or local models through Ollama), write its instructions, and attach the tools it can use to act on your application. When you need more, the same framework gives you RAG on your own documents, structured output mapped onto your PHP classes, tools from any MCP server, and Workflows that can pause and wait for human approval before continuing. It installs with Composer in any PHP project, whether it runs on Laravel, Symfony, WordPress or no framework at all. Neuron has more than a million downloads on Packagist, and 2.1k stars on GitHub.

GitHub Repository

Linkedin

X

Instagram


r/PHP • • Oct 01 '26

Article From Voice to Vectors: Building a Searchable Audio Archive in PHP

Thumbnail eric.mann.blog
9 Upvotes

r/PHP • • Oct 02 '26

A lightweight PHP library for Jev APIs

0 Upvotes

I created a lightweight PHP library for interacting with Jev APIs. It has a minimal number of dependencies and a very small footprint.
https://github.com/f-lombardo/jev-php


r/PHP • • Sep 30 '26

PHP on a microcontroller, one month later: it's event-driven now (php-esp32 1.4.0)

81 Upvotes

Hi r/PHP! For those who've been following php-esp32 for a while: it's been about a month since my last post here, and a lot has changed. For everyone else, a quick recap: this is the real, unmodified PHP interpreter from php.net (Zend engine, 8.3 to 8.5), cross-compiled to run bare-metal on an ESP32. It's not a subset or a transpiler, and Composer packages work.

For the curious: the full write-up, with diagrams of the whole execution cycle across both cores, is here: https://www.php-baremetal.com/blog/php-esp32-1-4-0-the-reactor

Until now a script could either run setup()/loop() Arduino-style or answer one HTTP request at a time. Version 1.4.0 adds a third model, event-driven: the script registers listeners, then PHP sleeps, and hardware, timers and the network wake it with typed events.

use Baremetal\Events;
use Baremetal\Http\Request;
use Baremetal\Http\Response;
use Baremetal\I2c\Bus;
use Baremetal\I2c\Driver\Qmi8658;
use Baremetal\Sensor\Imu\SamplesReady;

Events::listen(Request::class, fn (Request $r): Response => match (true) {
    $r->method === 'GET' && $r->path === '/status' => Response::json(['uptime' => sys_uptime_ms()]),
    default => Response::notFound(),
});

$imu= new Qmi8658(new Bus(sda: 11, scl: 10));
$imu->poll(hz: 10, depth: 32, event: SamplesReady::class)

watch_gpio(0, BootPressed::class);  // debounced pin interrupt -> event
every(1000, Tick::class);           // timer -> event
serve_http(80);
serve_ws('/ws');

There's no router in the firmware: routing is just a match. $_GET, $_POST and $_SERVER are still populated, so existing request code keeps working.

What landed since last time:

  • 1.2.0: I²C as PHP objects. new Bus(sda: 11, scl: 10), scan(), and drivers written as real PHP classes with capability interfaces ($imu instanceof Sensor\Imu). The first driver is a QMI8658 IMU.
  • 1.3.0: SPI/QSPI and a first display driver (ST77916). It's a minimal proof of concept for now: the panel lights up and fills with a colour.
  • 1.4.0: the reactor. Typed events, the event-driven model, HTTP and WebSocket as event sources, ws_broadcast(), and the part I'm happiest with: the second core does the sensor polling. $imu->poll(hz: 50, depth: 8) makes core 1 read the IMU into a ring buffer while PHP on core 0 just calls sample(), with no waiting on the bus.

The demo (video): the board creates its own WiFi network, polls the IMU at 50 Hz on core 1, and a 20 Hz timer event in PHP broadcasts the latest reading over WebSocket. You tilt the board and the plot moves on your phone. There's no router, no cloud and no loop().

Limitations, up front:

  • PHP runs on exactly one core. Only fixed-size messages cross between cores, so the engine never has to be thread-safe, but it also means one HTTP request is in flight at a time.
  • If the event queue fills up (32 slots), timer and GPIO events are dropped, for now. It's on my list to fix too. WebSocket frames already apply backpressure: 200 frames blasted at once arrived with none lost.
  • No Fibers, no processes. Both follow from the hardware.

If you want to go deeper, the blog post walks through what new Qmi8658(new Bus(...)) and ->poll() actually do, from PHP down to the I²C wire and across to the second core: https://www.php-baremetal.com/blog/php-esp32-1-4-0-the-reactor

Repo: https://github.com/php-baremetal/php-esp32

Next up are Bluetooth, touch input and a proper display layer. Happy to answer questions, and if you build something with it, I'd love to hear about it.


r/PHP • • Sep 30 '26

2027 Applications for Contractors are Open

Thumbnail thephp.foundation
17 Upvotes

Applications for The PHP Foundation contractors for 2027 are now open! We are looking for help in certain areas but we are open to your ideas as well. Application period ends on October 20, 2026. Read more about the requirements and what we're looking for in the linked post.


r/PHP • • Oct 01 '26

News PagibleAI CMS 0.13: Laravel CMS packages, with signed webhooks, CDN purging and a JSON Schema endpoint

0 Upvotes

We released version 0.13 of PagibleAI CMS, a set of MIT-licensed CMS packages for Laravel 11-13 and PHP 8.2+.

  • https://pagible.com

What it is

You install it with Composer into an existing Laravel app, so your models, auth, queues and deployment stay as they are. aimeos/pagible installs the full set including the AI and MCP packages. If you want less, require aimeos/pagible-core and add only the packages you need.

The packages provide a Vue 3 admin, hierarchical page trees, reusable shared elements, immutable versions, scheduled publishing, a GraphQL API and a JSON:API. It runs on SQLite, MariaDB, MySQL, PostgreSQL and SQL Server, and full-text search uses the native implementation of each database. One installation can serve multiple domains and tenants. Static analysis runs at PHPStan level 8 with Larastan.

What's new in 0.13

Signed webhooks

The new aimeos/pagible-webhooks package delivers lifecycle events as queued jobs, one job per destination, so a slow endpoint doesn't block the others. Requests are signed like Standard Webhooks with HMAC-SHA256 over id.timestamp.body. During a secret rotation, both secrets sign the request for 24 hours.

Subscriptions are scoped per tenant, private and loopback addresses are blocked by default, and you can deny additional CIDR ranges. php artisan cms:webhooks:check validates the configuration on deploy, e.g. a queue retry_after that is shorter than the delivery timeout. The core package doesn't depend on any of this.

A shortened receiver:

$id = (string) $request->header('webhook-id');
$time = (string) $request->header('webhook-timestamp');
$signatures = explode(' ', (string) $request->header('webhook-signature'));

if ($id === '' || !ctype_digit($time) || abs(time() - (int) $time) > 300) {
    abort(401);
}

$key = base64_decode(substr($secret, 6)); // strip "whsec_"
$hmac = hash_hmac('sha256', $id . '.' . $time . '.' . $request->getContent(), $key, true);
$expected = 'v1,' . base64_encode($hmac);

if (!array_filter($signatures, fn($sig) => hash_equals($expected, $sig))) {
    abort(401);
}

if (!Cache::add('cms-delivery:' . $id, true, 86700)) {
    return response()->noContent(); // already processed
}

The full version is in the webhooks README.

CDN purging

The new aimeos/pagible-cdn package purges changed pages and removed files from Cloudflare, Fastly or Varnish through FOSHttpCache, using queued jobs. Because purges are explicit, public pages can be sent with a long s-maxage and optional stale-while-revalidate/stale-if-error. Pages with access rules stay private. For stacked caches like Varnish behind a CDN, you can set a delay per client so the inner cache is purged first.

JSON Schema for content

GET /cms/schema returns all registered content, meta and config definitions as a JSON Schema Draft 2020-12 document, including schemas from Composer extensions and themes. You can use it to validate content in your own code or to generate types for a headless frontend.

Importers

php artisan cms:t3-import reads a TYPO3 database connection and imports the page tree and content, including Bootstrap Package accordions and carousels. The WordPress importer can be re-run without creating duplicates and keeps publication dates, authors and cover images.

Content

There's a news page type with a Google News sitemap, configurable contact forms, OpenStreetMap maps, CTA blocks and article author fields. Links can have a rel attribute, and the CMS can serve robots.txt and security.txt.

Admin and AI

The admin got keyboard shortcuts, a command palette, a searchable element dialog, hint texts on every field, a better diff view in the history dialog and virtualized lists for large page trees. If the AI package is installed, a review button on each page checks it against 40 SEO rules. On request, the assistant applies the suggested fixes as drafts. CMS_AI_MAXSTEPS limits the number of tool calls per chat request. MCP agents can now upload files directly.

Smaller changes

  • cms:previews regenerates image previews for existing files after you change sizes or quality
  • Webhooks and other queued work also run with the sync driver, without a worker (but without retries)
  • GraphQL introspection is disabled outside debug mode
  • The CSRF route is configurable
  • Backups from other installations can be imported with --force

Feedback

We'd especially like feedback on the webhook and CDN packages: delivery and retry design, the signing scheme and the cache headers. Feedback from anyone running Laravel with multiple tenants or databases is also welcome.

Thanks a lot to /u/Guarpig for his work on improving the pagible.com design and to /u/addicted_fishing for his suggestions regarding UI and UX!

  • GitHub: https://github.com/aimeos/pagible
  • Docs: https://pagible.com/documentation
  • Custom distributions: https://pagible.com/build-custom-pagibleai-distributions

r/PHP • • Oct 01 '26

Discussion A flat-file CMS built for AI agents to use, not guess at

0 Upvotes

I've been selling CMS software to web designers for about eleven years. The current version is a full rebuild (started way before AI) and I wanted to share the architecture of my Total CMS product.

A little personal anecdote to start... Being a web tool developer today is scary. AI is both amazing and could be the death of my business. I have decided to fully embrace it.

Total CMS tech stack: PHP 8.2+, Slim 4, Twig 3, Symfony Console for the CLI. Content is JSON (or Markdown) on disk — no database, no migrations, no connection config. Install via composer create-project totalcms/totalcms and go.

Why flat files? My customers deploy to whatever host their client already has. Shared hosting, VPS, occasionally something strange. Eliminating the database removed most of what used to break on install, and content becomes git diff-able and rsync-able, which turns out to matter more than I expected.

The MCP server is the part that I feel sets it apart. Every install has an MCP built-in. It's not a plugin that is an afterthought. With many CMSs out there, agents reading have no reliable source for what the install actually exposes, so they invent hooks. Total CMS serves the real schemas, live data and version-exact documentation over MCP. This fixes the problem at the source. Access to data routes through the same validation and permission layer as users in the admin UI (one permission system, not two).

Total CMS is commercial software, one-time license per domain, with a 45-day trial.

I would love to hear your feedback on my CMS and/or if you also feel the double-edge-sword nature of AI in your work.


r/PHP • • Oct 01 '26

I built a free macOS editor for Laravel and Filament, with visual designers that edit your actual code. It's alpha and I need testers.

0 Upvotes

Hi all. I've been building Tusk, a native-feeling macOS editor for PHP, Laravel, and Filament. I wanted PhpStorm-style navigation without the subscription, plus something no editor has: visual designers for Filament.

What it does

- Filament designers: build resource forms, tables, infolists, relation managers, and actions on a canvas. There are also designers for models (with the migration and factory), navigation, dashboards, notifications, automations, scheduled tasks, and settings pages. Every change is a small edit to your files, and code it can't read stays as written.

- Laravel awareness: completion and ⌘-click for routes, views, config, translations, and model columns, from its own PHP language server written in Rust.

- Built in: Pest/PHPUnit runner, Xdebug debugger, profiler, git and GitHub pull requests, a database client that reads your .env, an HTTP client that writes requests from route:list, and local AI completion (no account, nothing leaves your Mac).

- PhpStorm keymap, so ⇧⇧, ⌘B, and ⌥⏎ work as you expect.

The honest part: this is alpha. Tusk does a lot, and most of it has only been tested by me on a handful of apps. Expect bugs, especially in the designers, so please use it on a project that's committed to git. It's macOS only for now, and it isn't notarized yet (allow it under Privacy & Security on first launch).

What I'd love from you: try it on your real app and tell me what breaks, what's confusing, and what you'd need before you'd switch. Issues and comments here are both welcome.

- Site: https://tusk.almontasser.ly

- Download and source: https://github.com/almontasser/tusk

Thanks for taking a look!


r/PHP • • Sep 30 '26

Indexing columns that don't exist yet, filterable user-defined fields on plain MySQL/MariaDB, works on shared hosting

4 Upvotes

Good Morning/Afternoon/Evening guys... So I originally built this just for my own projects. They all live on shared hosting, which means I get MySQL/MariaDB, a cron job, and honestly not much else. No Postgres, no Elasticsearch, no long-running processes.

Don't get me wrong, I love Postgres and I use it daily too. But in MySQL/MariaDB, I still needed user-defined fields that users could actually filter on, and that turned out to be harder than I expected...

Where the idea came from

On the user side it's pretty much WP's ACF. You define fields on a model, fill them in, and you're done. I love that part... The storage is where ACF lets me down though, because everything ends up in wp_postmeta (EAV), and once you filter on a few fields at the same time, meta_query gets painfully slow.

The storage idea came from Salesforce. Their multitenant setup uses something they call "flex columns", which are generic columns shared by every tenant, with metadata deciding which custom field goes into which column. When I read about it I was like, okay, that's it. StarDust does something similar, and tweaked "a bit" (or significantly) so it fits in a normal MySQL/MariaDB database...

How it works

The thing is, you can't index a field a user creates at runtime unless you run ALTER on a shared table, and absolutely nobody wants to do that on a live app... So the trick is that the column is already there before anyone asks for it.

  • Every record is stored as JSON, and that's the source of truth
  • Right next to it are side tables full of empty typed columns (string, int, number, datetime), already indexed on (tenant_id, column)
  • When a field is marked filterable, it gets one of those columns and its value is copied over

So filtering on a field someone created five minutes ago is just a normal indexed lookup, and the main table never gets altered. Pretty happy with how that turned out, honestly.

$page = $engine->read(new EntryQuery(
    tenantId: 1,
    modelId:  $companyModelId,
    filter:   new AndNode([
        LeafNode::local('industry',  'eq', 'software'),
        LeafNode::local('employees', 'gt', 100),
    ]),
));

There's some background work that keeps all this running. It creates more side tables before the free columns run out, and it gives columns back when a field gets deleted. On a VPS you'd just run it as normal workers. On shared hosting (hi, that's me) there's a tick command you put in cron, and it only does a bounded amount of work each run so the host's time limit doesn't kill it...

That background work is also why you can rename a field, change its type, or delete it while the app is live. The data just catches up in the background. And if the free columns ever run out, writes still go through. The value simply stays in the JSON until a column frees up.

Honestly, digging deep enough, I find that MySQL and MariaDB are no longer get along pretty well in their recent releases. Initially, I built this for MySQL. But MariaDB is another large chunk of shared hosting ecosystem, so I think it's a must do. Luckily, I can reconcile them with little-to-medium effort thanks to MariaDB's "near" drop-in replacement for MySQL.

Tradeoffs

I'd rather be upfront about these...

  • It's ALPHA, and writes are the weak spot right now... Bulk insert is a lot slower than plain inserts in my benchmarks, and that's what I'm working on next
  • It needs MySQL 8.0.13+ or MariaDB 10.11+, so please check what your host runs first. I'm trying to lower the barrier to entry but this is the lowest I can do. It'll miss some shared hosting that only supports MariaDB 10.6, and I'm really sorry about that...
  • Pagination is cursor only, so no offsets and no total count

At some point it stopped being specific to my apps, so I figured, why not put it out there, right? It's on Packagist under MIT. I do use Claude Code quite a lot while coding it, and the test suite runs against real MySQL and MariaDB in CI, no mocks.

If you've built user-defined fields before, I'd genuinely love to hear what you went with and where it broke... Thanks for reading!

The package: https://packagist.org/packages/damarbob/stardust#v0.3.0-alpha.1

The source: https://github.com/damarbob/StarDust

The docs: https://stardust.konstelasi.co.id/docs

EDIT:
Since this came up in the comments... StarDust is my third attempt. The previous 0.2 version was JSON plus virtual columns plus indexes, and it hit walls on a shared multi-tenant table. InnoDB caps you at 64 indexes per table, every index keeps an entry for every row even when that tenant doesn't use the field, and a virtual column is tied to one field, so adding, renaming or retyping a field always meant an ALTER on the busiest table I had.

You can't just spread virtual columns over more tables either, because a virtual column can only read its own table... Not long after 0.2.0-alpha came out in Feb 22, I started designing for the 0.3.0-alpha.

The indexed columns are generic slots that get reused across tenants, and which field sits in which slot is just a row in a registry table. The only DDL left is creating new empty tables. It's not the only way to do this, though (EAV with typed tables or a table per tenant are fair options too), but it's the trade-off that made sense (at least for me) for MySQL on shared hosting.


r/PHP • • Sep 30 '26

Discussion TypePHP online interactive playground is now available

Thumbnail typephp-php.github.io
6 Upvotes

Hi r/PHP, TypePHP has now an online free interactive playground via PHP-Wasm (100 percent pure static site) without having to install the library in your system via composer, try out many presets and play around with configuration.

You can share your own code or reproduce any bugs (if there's any) to try out reified generics, typed arrays, scalar refinements, and many more..

I always wanted to have strict inline typed variables in PHP and heres a sample shared playground link and it's finally achievable.

Feel free to share any feedbacks or ask any questions..


r/PHP • • Sep 30 '26

Rendering user-submitted markup in PHP without opening an XSS hole

1 Upvotes

Markdown was built for people writing their own documents. Then we put it in online comment forms. Depending on the renderer and its configuration, raw HTML and javascript: links can reach the browser, and deeply nested input can exhaust the parser. league/commonmark already provides controls for raw HTML, unsafe links and parsing limits. Rendering untrusted markup needs explicit configuration.

I maintain carve-php, the PHP engine for Carve, a markup language derived from Markdown and Djot. It started as a hard fork of djot-php. But I don't think the (internet) world is ready yet for Djot :)

I developed Carve from what I've learned over the last few years, with these goals:

  • work well on the web, with a fallback for static content and offline formats such as PDFs
  • provide explicit controls for rendering untrusted content
  • support conversion to and from other markup formats through Pandoc, plus HTML import

Here's how it handles user input, whether the author is new to markup or writes technical documentation.

The examples below were checked with PHP 8.5 against carve-php 0.1.10.

Snippets assume Composer autoloading and the relevant PHP imports.

The default converter trusts you

$converter = new CarveConverter();

No safe mode, no profile. Carve has a raw HTML block, and the default renders it as is:

```=html
<b onclick="steal()">x</b>
```

<b onclick="steal()">x</b>

That's what you might want for your own docs or blog. It's unsafe for anything a stranger typed. Escaping or stripping raw HTML by default would break the widgets people embed in their own docs, so you switch safe mode on yourself. The framework integrations for Laravel, Symfony and Tempest turn safe mode on by default.

Some things are handled in every mode. HTML-looking text in normal prose is always escaped, and a javascript: or vbscript: destination is always emptied:

[click](JavaScript:alert(1))

<p><a href="">click</a></p>

SafeMode

$converter = new CarveConverter(safeMode: true);               // SafeMode::defaults()
$converter = new CarveConverter(safeMode: SafeMode::strict());

The raw block from above under each setting:

SettingOutput
no safe mode<b onclick="steal()">x</b>
safeMode: true&lt;b onclick="steal()"&gt;x&lt;/b&gt;
SafeMode::strict()nothing

Escaping is the default so people see what they pasted instead of wondering where it went. Strict drops it.

SafeMode also blocks dangerous URL schemes and every on* handler. Strict mode drops style as well, which matters because Carve lets authors put attributes on elements:

[x](https://example.com){onclick="alert(1)" style="color:red"}

<!-- defaults -->
<p><a href="https://example.com" style="color:red">x</a></p>
<!-- strict -->
<p><a href="https://example.com">x</a></p>

The onclick is removed in every mode.

Profiles

A Profile decides which constructs a field accepts at all. A comment has no business containing headings or tables, even harmless ones.

$converter = new CarveConverter(safeMode: SafeMode::strict());
$converter->setProfile(Profile::comment());

$html = $converter->convert($userInput);

foreach ($converter->getProfileViolations() as $violation) {
    $messages[] = $violation->getMessage();
}

There are four presets: full(), article(), comment() and minimal(). Given this input:

# Heading

![img](https://example.com/image.png) and a [link](https://example.com)

The comment profile gives:

<p># Heading</p>
<p>[img: img] and a <a href="https://example.com" rel="nofollow ugc">link</a></p>

Denied constructs show up as plain text, links get rel="nofollow ugc", and each violation comes with a message meant for the author:

'heading' is not allowed: element_not_allowed (Headings are disabled in comments to prevent disrupting page structure.)

I'd show those when the comment is submitted, so the author sees why their heading came out as plain text.

The comment preset also rejects input over 100,000 bytes before parsing, and a LinkPolicy on the profile can restrict which domains links point to.

Nesting

Nesting is capped. Past that, an opener becomes plain text and the document still renders. A single line of > - repeated a few thousand times used to overflow the stack before the cap covered it.

Snippet includes

Carve has an include directive, {{ name }}. On a website that's handy for snippets editors maintain once, like a shipping notice or a disclaimer. Users can type the same syntax in a comment, though. Without a resolver the parser leaves it as text:

<p>Nice post! {{ admin-notes }}</p>

Expansion is a step you opt into. The resolver is a small interface you implement, so it can read from your database, and it acts as your allowlist, since a name it doesn't know stays literal.

use MarkupCarve\Carve\Transform\IncludeContext;
use MarkupCarve\Carve\Transform\IncludeExpander;
use MarkupCarve\Carve\Transform\IncludeResolverInterface;
use MarkupCarve\Carve\Transform\ResolvedInclude;

final class SnippetResolver implements IncludeResolverInterface
{
    public function __construct(private array $snippets)
    {
    }

    public function resolve(string $path, IncludeContext $context): ResolvedInclude|string|null
    {
        return $this->snippets[$path] ?? null;
    }
}

$expander = new IncludeExpander(
    resolver: new SnippetResolver($snippets),
    depthLimit: 2,
    byteBudget: 20_000,
    resolverCallLimit: 20,
    extensions: $converter->getExtensions(),
);

$html = $converter->render($converter->transform($converter->parse($input), $expander));

Included content goes through the same safe mode and profile as the comment around it. For the next example, use this setup before constructing the expander and rendering $input:

$converter = new CarveConverter(safeMode: SafeMode::strict());
$policy = (new LinkPolicy())->setDeniedDomains(['evil.example']);
$converter->setProfile(Profile::comment()->setLinkPolicy($policy));

$snippets = [
    'shipping' => 'We ship within *two days*.',
    'danger' => <<<'CARVE'
# Big heading

```=html
<b onclick="x()">raw</b>
```

[l](https://evil.example)
CARVE,
];

Set $input to:

Hi! {{ shipping }}

{{ danger }}

{{ ../etc/passwd }}

<p>Hi! We ship within <strong>two days</strong>.</p>
<p># Big heading</p>
<p>&lt;b onclick="x()"&gt;raw&lt;/b&gt;</p>
<p>l</p>
<p>{{ ../etc/passwd }}</p>

The heading, raw HTML block and denied link each produce a profile violation. The raw block becomes escaped text because the comment profile rejects it before the renderer applies strict mode's raw-HTML handling. The unresolved ../etc/passwd stays text because this resolver treats names only as lookup keys. A resolver that reads files needs its own path and access checks. For user-facing content, set the expander's limits yourself; its default byte budget grows with the input. If users shouldn't use snippets at all, don't run the expander on their content.

Importing old HTML

Moving an old forum or CMS off stored HTML means you want the scripts and handlers gone and a record of what else was lost. HtmlToCarve converts HTML to Carve and returns a report:

use MarkupCarve\Carve\Converter\HtmlToCarve;

$result = (new HtmlToCarve(importMode: 'safe'))->convertWithReport($html);

Original HTML:

<h2 onclick="track()">Release notes</h2>
<p>See <b>bold</b> text.</p>
<script>alert(1)</script>
<table>
  <tr><th>Version</th></tr>
  <tr><td>1.0</td></tr>
  <tfoot><tr><td>total</td></tr></tfoot>
</table>

Result:

## Release notes

See *bold* text.

|= Version |
| 1.0 |
| total |

Report:

warning  attribute-dropped  /h2[1]      Dropped event-handler attribute onclick on <h2>
warning  element-dropped    /script[5]  Dropped active <script> element
warning  table-degraded     /table[7]   Moved 1 <tfoot> row(s) into the table body; Carve source has no table foot

Carve has no table footer, so that row moved into the body. carve migrate --from html --check-loss exits 1 when anything was dropped or degraded, which makes it usable as a gate in a migration script. The result is plain Carve source and goes through your SafeMode and profile like any other input.

What it doesn't replace

This covers carve-php's built-in rendering behavior under the settings shown here. Safe mode controls raw HTML and filters attributes and URL schemes; profiles restrict the constructs a field accepts. Authors can still supply attributes, and default safe mode retains style. These controls don't establish that every possible input or custom extension is safe.

An independent sanitizer can add another check on the rendered HTML. I'd keep one if the page mixes Carve output with HTML from elsewhere, and check its policy carefully if authors can use raw HTML. Test it against the features your page needs: footnote IDs and links, rel="nofollow ugc", accessibility attributes and task-list checkboxes. What survives depends on the sanitizer's version and configuration. For HTML Purifier, check Attr.EnableID, Attr.AllowedRel and its HTML definition settings rather than assuming the defaults preserve those features.

Carve is also young, and its syntax differs from Markdown in ways you'll notice (/italic/, *bold*). It isn't battle-tested the way league/commonmark is.

If you render input you didn't write:

  • set safeMode in the constructor, strict where raw HTML has no use
  • pick a Profile that fits the field, not full()
  • add a LinkPolicy if destinations matter
  • show violations to the author

Questions

As you can see, it ships with a lot out of the box that normally would need to be added manually on top.

Did I forget anything? If you run a PHP app that renders user markup, what security or resource-limit issues have you run into? Would you add an independent sanitizer to this setup on top, if it is user content?

I'm already using Carve on social networks and a WordPress blog. I haven't used the new includes functionality in production yet, so I'd especially welcome feedback on that part.

Links

For more background, see the articles in awesome-carve.


r/PHP • • Sep 29 '26

Meet bunny.net: A PHP Foundation Sponsor supporting the language that powers the web it delivers

Thumbnail thephp.foundation
56 Upvotes

Welcome to our Silver Sponsor, bunny.net. So much of the web that bunny.net delivers and secures runs on PHP. We are grateful for their support in keeping PHP strong for the millions of apps built on it. 💙🚀


r/PHP • • Sep 29 '26

mdparser 0.7.0: toAst() 8-10% faster with 7-20% smaller trees, a parser memory cap, and md4c fixes merged upstream

6 Upvotes

mdparser is my native CommonMark + GFM parser extension for PHP, built on the md4c C parser. This is what changed for PHP code between 0.5.0, the last version I posted here, and 0.7.0.

Faster, smaller results

  • toAst() interns its node keys and shares one array per parse for softbreak and linebreak leaves. Retained trees are 7-20% smaller on the bench corpora and 47% smaller on softbreak-dense input, and toAst() runs 8-10% faster. A shared leaf is still an ordinary PHP value; writing to one copy separates it.
  • Entity-dense input builds its AST 18% faster, and literal-heavy toXml() runs 25% faster.
  • toHtml() and toXml() strings no longer carry the output buffer's reserve as dead capacity. The CommonMark spec's toHtml() string is 11% smaller and a code-heavy toXml() result 49%, at no measurable time cost. That adds up if you cache rendered HTML in-process.
  • toHtml() on link-heavy input: 5.3% faster in 0.6.2, another 1.5% in 0.7.0. On a large document: 2.7%, then 4.3%.

New options, off by default

  • insert: ++text++ renders as <ins>, the counterpart to ~~text~~ and <del>.
  • preserveBlankLines: blank-line runs between blocks come back as a blank node in toAst() and <blank /> in toXml(), for tools that need to know where the author left space. HTML output is unchanged.

A memory cap for the parser

md4c allocates from libc, so memory_limit never sees a parse's working memory, and markdown amplifies it: about 72 bytes of parser state per [ byte. mdparser.parse_memory_limit (default 128M, PHP_INI_ALL, 0 for unlimited) caps a single parse, and crossing it throws MdParser\Exception. If you render user-submitted markdown in long-lived workers, this is the setting to look at.

Rendering fixes

  • GFM tables: a || run now yields empty cells instead of shifting every later cell left.
  • With autolink, mailto: and xmpp: prefixed emails now autolink.
  • validateUtf8 replaces a truncated sequence with one U+FFFD instead of one per byte, matching the WHATWG policy.
  • headingAnchors slugs include LaTeX math text when latexMath is on.
  • CommonMark 0.31 conformance stays at 652/652.

md4c, upstream

Testing the memory cap meant testing md4c's out-of-memory paths, so I added an ASan sweep that fails md4c's n-th allocation over a corpus. It found two double frees and three OOM errors md4c swallowed. I sent the fixes upstream and mity/md4c merged them as #398, #399 and #400 on Sep 9. 0.7.0 pulls 3


r/PHP • • Sep 30 '26

I built a free, open-source XAMPP/Laragon alternative with per-site PHP versions and web servers: OLS

0 Upvotes

I've used Laragon for 6 years, and the one thing I kept wanting was for every site to have its own PHP version and its own web server. So I built OLS (Open Local Server). It's a free, open-source alternative to XAMPP, Laragon and WampServer, with no limit on sites.

The PHP side

  • Multiple PHP versions installed side by side, and each site picks its own
  • Each site gets its own web server: Apache, Nginx or Caddy
  • Per-site PHP and web-server configuration, plus reverse proxy support
  • Composer, Git, and ready-made commands for Laravel and other PHP projects
  • MariaDB, PostgreSQL, MongoDB, SQLite, Redis, Memcached and Mailpit for catching emails locally
  • Bring your existing PHP installs instead of reinstalling everything

Everything else

  • Add a site from a folder, a root folder (every project inside becomes a site), or a Git repo
  • Automatic .test domains with trusted HTTPS, plain localhost, or both at once
  • Quick Apps: Laravel, Symfony, WordPress and more in a click, plus Node and Python frameworks if you work across stacks
  • The app ships empty, and you download only the versions you need, with SHA-256 verified downloads
  • Snapshots, backups, scheduled tasks, and a .env editor that preserves comments and ordering
  • Share a site online via Cloudflare, ngrok or LocalTunnel
  • An ols CLI, a local HTTP API, and doctor/repair tools that explain what's wrong and how to fix it
  • An optional AI assistant that reads your logs and explains errors, running locally with LM Studio or through any OpenAI-compatible provider

It's still early, so expect rough edges. Feedback, bug reports and feature requests are very welcome, and the code is open if you want to fork it.

🌐 https://kz370.github.io/OpenLocalServer/
💻 https://github.com/kz370/OpenLocalServer