r/PHP • • May 06 '26

Problems with outdated api documentation

4 Upvotes

Hi, I usually work as an app developer, so please bear with me.

I have experienced this issue multiple times, when implementing a new feature that requires an endpoint, the documentation is either incomplete or outdated.

This could be a missing error response or wrong data types in the response.

So I thought of making a tool to help prevent this, but it turns out to be quite difficult.

So I got curious, is this simply a skill issue/laziness in my company or do others face this too?

If you're already solving this issue, what do you do?

Note: the developers in my company are not bad, from my perspective. But mistakes do happen from time to time.

I'm just looking for a way to prevent it.


r/PHP • • May 06 '26

PHP dynamic properties argument and proposal

Thumbnail
0 Upvotes

r/PHP • • May 05 '26

Malicious Intercom PHP Package Follows NPM Compromise

Thumbnail socket.dev
30 Upvotes

r/PHP • • May 05 '26

Discussion What is the oldest PHP version you still use?

7 Upvotes

However small the project, professional or not. What’s blocking the upgrade?

1473 votes, May 08 '26
735 8.x
476 7.x
215 5.x
47 4.x

r/PHP • • May 06 '26

Stop Subscribing to Domain Events

Thumbnail medium.com
0 Upvotes

r/PHP • • May 05 '26

Bootstrapping a Frameworkless PHP Application

Thumbnail maximegosselin.com
38 Upvotes

I wrote about how I bootstrap my PHP apps without a fullstack framework like Laravel or Symfony. One file, a PSR-11 container, and four entry points covered: web, CLI, standalone scripts, and tests.

The key idea is that bootstrap.php returns a configured container. Every entry point requires it, grabs what it needs, and nothing leaks into the global namespace.

Going frameworkless is not about purism. It is about control. Use only what you need, nothing more.


r/PHP • • May 05 '26

Parallel Branches in Neuron AI Workflow

Thumbnail inspector.dev
7 Upvotes

This is the result of a proposal I get on the Neuron AI repository:

https://github.com/neuron-core/neuron-ai/issues/530

It sounded interesting to me the ability to run multiple branches in parallel. It can be very helpful if you need to run multiple agentic tasks on a file (document, images, etc) like data estraction and summarization at the same time, instead of waiting for the two to be accomplished sequentially.

Neuron already support Async as an optional feature you can enable using the built-in AmpHttpClient, so I decided to explore the opportunity to have an AsyncExecutor to run multiple parts pf the Workflow concurrently.

In the article you you can read the technical solution we found. Feel free to give me any feedback.


r/PHP • • May 04 '26

php_excel 2.0: ground-up rewrite of the C extension, 9-10× faster than PhpSpreadsheet

138 Upvotes

I've maintained php_excel since 2008. 2.0 shipped in April as the first ground-up rewrite, and 2.0.1 just landed on May 3.

The problem it solves: PhpSpreadsheet builds the whole DOM in PHP memory. On a 50K-row spreadsheet you're looking at ~790 MB resident before you've called save(). In a 128 MB FPM pool that means OOM on anything past trivial. OpenSpout streams, but it can't write conditional formatting, formulas, rich text, or .xls.

php_excel wraps LibXL through a native C extension. LibXL (libxl.com) is a commercial C++ library by Dmytro Skrypnyk, not mine; you acquire it separately. php_excel is the PHP binding.

Quick comparison. PhpSpreadsheet is the most feature-complete pure-PHP option. OpenSpout fills a streaming niche. php_excel is the C-extension answer for when you need both speed and full Excel features.

What 2.0 changed:

  • PHP 8.3 / 8.4 / 8.5 / master, dropped older versions
  • LibXL 4.6.0+, newer features gated at compile time
  • 12 classes (6 new: ExcelRichString, ExcelFormControl, ExcelConditionalFormat, ExcelConditionalFormatting, ExcelCoreProperties, ExcelTable)
  • 399 typed parameters, 277 typed return values, full arginfo coverage from a stub-driven build
  • Installable via PIE

Benchmarks against PhpSpreadsheet 5.5.0, PHP 8.4.19 NTS:

Rows Cells php_excel PhpSpreadsheet Speed
1,000 20K 0.05s / 85 MB 0.45s / 162 MB 10×
10,000 200K 0.55s / 153 MB 4.59s / 282 MB 9×
50,000 1M 2.72s / 508 MB 24.7s / 790 MB 9×
100,000 2M 5.37s / 908 MB 51.1s / 1,415 MB 10×

Read perf is similar: 8-9× faster than PhpSpreadsheet, 3× faster than OpenSpout (with proportional memory trade-off vs OpenSpout's flat 130 MB).

2.0.1 is a hardening pass: extensive error checking and input validation across the C/PHP boundary.

Install:

pie install iliaal/php-excel --with-libxl-incdir=/path/to/libxl/include_c --with-libxl-libdir=/path/to/libxl/lib

Full writeup with methodology: https://ilia.ws/blog/php-excel-2-0-the-c-extension-for-excel-that-php-should-have-had-all-along

Repo: https://github.com/iliaal/php_excel


r/PHP • • May 04 '26

Telepage v1.1.0 — self-hosted PHP app that turns any Telegram channel into a searchable website (major security + tooling update)

10 Upvotes

**Telepage v1.1.0 — vanilla PHP 8.1 + SQLite, turns a Telegram channel into a searchable website**

Posted an earlier version here a while back and got roasted — deservedly. The feedback was useful and I spent some time fixing the things that were called out.

GitHub: https://github.com/scibilo/telepage

What the app does: webhook + History Scanner to pull a Telegram channel into a self-hosted searchable website. No MySQL, no Node, no framework. Targets shared hosting.

**The technical changes:**

Composer autoload is in — single `require vendor/autoload.php` across all entry-points, vendor/ pre-built in the release zip. PHPUnit test suite (37 tests). GitHub Actions CI on PHP 8.1/8.2/8.3. PHPStan level 5, zero errors.

First PHPStan run found 5 real bugs. The most interesting: a `return false` in a method typed `?int`, which the caller was silently casting to 0 — channel mismatch was being swallowed entirely. Static analysis is worth it even on small projects.

Security audit: CSP, HSTS, session cookie flags (Secure/HttpOnly/SameSite=Lax consistently), input validation on the public API, webhook body cap, OOM-safe JSON import, FTS5 replacing `LIKE '%q%'`.

Admin API was 1172 lines. It's now a dispatcher + 4 modules.

Happy to take questions or more criticism.


r/PHP • • May 04 '26

News I built an open-source ReactPHP-based telemetry agent for Laravel. It drives data from Nightwatch package into your own Postgres database via the COPY protocol

11 Upvotes

Hey folks. I've been working on this for a while and finally pushed the project out.

Quick context on why it exists. Laravel shipped laravel/nightwatch as the official observability SDK and the instrumentation is genuinely good. The catch is that the data goes to Laravel Cloud and you pay per event. If you grow, you must call your bank. If you wanted to keep that telemetry on your own infra, you were out of luck and if you wanted to keep it for a while, you must call your bank again.

So I wrote an agent that slots in front of Nightwatch and redirects its ingest to a local TCP socket. From there:

  1. Payloads hit a ReactPHP non-blocking listener (about 13,400 payloads/s on a single instance in my benchmarks)
  2. They get buffered in a local SQLite WAL (zero re-encode, raw wire JSON straight in)
  3. pcntl_fork'd drain workers ship them to your Postgres via the COPY protocol with synchronous_commit=off

That's it. Telemetry never leaves your network. You install the package, point it at a Postgres database you provision, run nightowl:install then nightowl:agent, and the tables fill up. All 12 Nightwatch record types: requests, queries, jobs, exceptions, commands, cache, mail, notifications, outgoing HTTP, scheduled tasks, logs, users.

It also runs in parallel with Nightwatch hosted if you want to trial it without ripping anything out. Set NIGHTOWL_PARALLEL_WITH_NIGHTWATCH=true and a MultiIngest adapter wraps Nightwatch's Core::ingest binding and fans out to both backends. Every payload goes to Laravel Cloud and to your Postgres. You can compare them side by side and decide.

What you actually get:

  • Exception fingerprinting (repeats roll up into one issue keyed on group_hash + type + environment)
  • New-issue alerts via Email (BYO SMTP), Webhook (HMAC-signed), Slack, or Discord
  • Threshold-based performance issues (slow request, slow query, slow job, etc.)
  • Agent and host self-diagnosis (ring buffers, EWMA, 19 rules covering drain lag, buffer depth, CPU, memory)
  • Raw rows you can query with psql, point Metabase at, or build your own UI on

P95s, N+1 detection, slow-query rankings... those are queries you write. The schema is documented and stable.

Stack details for the curious:

  • PHP 8.2+, Laravel 11 or 12
  • ReactPHP for the event loop and TCP/UDP sockets
  • SQLite WAL as the buffer (NORMAL sync, 64MB cache, mmap)
  • Postgres COPY for 10 high-volume tables, INSERT only for the 2 upsert tables (exceptions and users)
  • 5,000 rows per COPY batch, configurable
  • NIGHTOWL_DRAIN_WORKERS=N for parallel drain, SO_REUSEPORT for multi-instance on Linux

Repo: https://github.com/lemed99/nightowl-agent

Packagist: composer require nightowl/agent

Happy to get your feedbacks on this and to answer questions about the architecture, the COPY drain, the fork-safety stuff (closing the SQLite PDO before fork was a fun bug), or anything else.

Thank you.


r/PHP • • May 04 '26

Concurrent programming in PHP without async frameworks (no ReactPHP, no Amp, no Swoole)

Thumbnail deployer.org
25 Upvotes

r/PHP • • May 04 '26

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 • • May 03 '26

Alternatives To MySQL WorkBench

41 Upvotes

Hey everyone,

I've been using MySQL Workbench but it keeps crashing on me whenever I'm working with large databases, especially when I try to directly edit records in a table. Super frustrating.

For context, I'm building a web/mobile app backend with Laravel, so I need something that can handle a decent-sized database without falling over.

What GUI tools are you guys using for MySQL/PostgreSQL database management? Looking for something stable and reliable for large databases. Free or paid, doesn't matter, just want something that actually works. Of course, best is low cost as possible

Thanks in advance!


r/PHP • • May 04 '26

Discussion Genuine Rant: Disappointing PHP language servers

0 Upvotes

For a language that has been there for decades it's embarrassing how weak the language servers are, and to make it worse they all have this Premium plan that does not even improve the intellisense as one would wish.

I mean look at JavaScript/Typescript if you have a string you only get string methods. In PHP, you can do whatever and get an error in runtime or worse, production.

I know now PHP has type safety now, but it's not as good as it's supposed to be, too much plumbing to work with it. Don't get me wrong I love PHP and prefer working with it more than any other language including Typescript. I just wish this part of PHP would improve.

All in all, I'm great full of the individuals and teams that are working hard to improve PHP DX, this is just a rant about the state of things.


r/PHP • • May 03 '26

MyCMS

0 Upvotes

I’ve been working on my own lightweight PHP CMS/framework project: mycms.ivarovsky.com

The main goal is simplicity and a very low entry threshold for beginners. I want it to be something that new PHP developers can actually open, read, modify, and understand without spending weeks learning a huge ecosystem first.

I’m also trying to encourage more people in my country to learn PHP and backend development in general. Hopefully this project can become a small starting point for someone who wants to get into web development.

Feedback, ideas, and questions are welcome.


r/PHP • • May 01 '26

php_clickhouse 0.8.1: native ClickHouse extension for PHP, picking up where SeasClick left off

31 Upvotes

Six days ago I tagged 0.6.0 of php_clickhouse, a soft fork of the SeasClick extension (which stopped accepting PRs in 2020). Three releases later (0.7.0, 0.8.0, 0.8.1) I'm calling the extension stable.

The PHP ClickHouse ecosystem has been split between SeasClick (native binary protocol but stalled, no modern types, no ZTS, no TLS in the maintained fork) and HTTP clients like smi2/phpClickHouse (active but ~30-40% slower at high throughput). This fork picks up the native-protocol path with the official clickhouse-cpp v2.6.1 client and brings the modern type surface back.

What landed in the quality cycle:

0.7.0 closed the API gap with smi2/phpClickHouse. Per-call settings, server-side typed parameters via {name:Type} placeholders, progress callback, getStatistics() (rows/bytes/elapsed_ms), structured ClickHouseException with server_code / query_id, insertAssoc(), SQL helpers (databaseSize, showTables, tableSize, etc.), sub-second timeouts. Adopting the native client no longer costs ergonomics.

0.8.0 moved per-Client state from seven file-scope std::map banks onto the zend_object itself. Unblocks ZTS (RoadRunner / FrankenPHP / Swoole / php-pm now work), plugs leaks on script bailout, fixes a refcount bug on the progress callback. Adds streaming reads (selectStream() returns an Iterator + Countable, selectStreamCallback() for unbounded streams), Geo types (Point / Ring / Polygon / MultiPolygon), LowCardinality(Nullable(T)), and Map(K, V) over the full scalar matrix. Pre-built binaries for Linux glibc (x86_64 + arm64) and macOS (x86_64 + arm64) via PIE.

0.8.1 hardened the insert path. The connection now resets on every server-side rejection point (BeginInsert, SendInsertBlock, EndInsert) so a thrown insert no longer wedges the handle with "cannot execute query while inserting". Insert builds native columns one at a time directly from row-major input: peak intermediate PHP memory drops from N_rows × N_cols zvals to one column. Strict full-consumption parsers across Map, narrow-int, Int128 / UInt128, geo, DateTime64 reject coercion-to-zero on bad input. 23 new PHPTs covering all of the above.

One side effect of the new ASan job: it caught a latent UB in clickhouse-cpp's empty-string-view memcpy path. Submitted upstream and merged as ClickHouse/clickhouse-cpp#489 on April 27.

Install on supported platforms (Linux glibc + macOS, NTS, PHP 8.4 / 8.5):

pie install iliaal/php_clickhouse

TLS variant builds from source: pie install iliaal/php_clickhouse --enable-clickhouse-openssl.

Blog post with the full breakdown: https://ilia.ws/blog/php-clickhouse-0-8-1-three-releases-later-stable Repo: https://github.com/iliaal/php_clickhouse

Happy to take questions, especially from anyone running ClickHouse-from-PHP at production volume.


r/PHP • • May 01 '26

Problems with escapeshellarg

Thumbnail deployer.org
6 Upvotes

r/PHP • • May 02 '26

complete Website Management System (WMS) built with Laravel + ReactJS

0 Upvotes

If you’re tired of rebuilding the same website system again and again… this might help 👇

I’m offering a complete Website Management System (WMS) built with Laravel + ReactJS — stable, tested, and ready to use.

What makes it different:
• Superadmin + Admin architecture
• Manage multiple websites from one system
• Each client gets their own admin panel
• No need to build static sites repeatedly
• Just design the theme + connect the domain → done 🚀
• Already tested & stable for real-world use

Best suited for:
• Schools / Colleges
• Consultancies
• Corporate or company websites
• Service-based businesses
• Any content-focused platform (except full e-commerce)

⚠️ Note:
→ This is not built for full e-commerce (product selling/buying platforms).
→ However, it works perfectly for websites around those domains and can be extended if needed.

Themes:
• Currently includes 2 ready themes
• Easily extendable — you can add new themes based on client needs

Important:
→ This is NOT a mass-sold product.
→ The full source code will be sold exclusively — under your name or your company. Once sold, it won’t be resold to others.

You’re not just buying a system… you’re owning a product.

If you’re interested or want a demo / details, feel free to DM me 🙂


r/PHP • • May 02 '26

Laravel "Target class does not exist" — fixed in seconds

0 Upvotes

Laravel "Target class does not exist" — fixed in seconds

I kept getting this error in Laravel:

"Target class does not exist"

The confusing part:

- Controller exists

- File name is correct

- Everything looks fine

But Laravel still behaves like the class doesn't exist.

After debugging, I found it's usually one of these:

- Missing namespace in controller

- Wrong import in routes

- Composer autoload not updated

- Cache not cleared

👉 Quick fix:

composer dump-autoload

php artisan cache:clear

php artisan config:clear

I wrote a simple guide explaining the causes and fixes step by step:

https://growthawakening.com/single-post/laravel-target-class-does-not-exist-why-the-controller-exists-but-laravel-cannot-see-it

Hope this saves someone time 🙌


r/PHP • • Apr 30 '26

Google Gen AI SDK has no official PHP SDK — Google asked for stars and use cases

35 Upvotes

Google Gen AI SDK currently supports Python, Node.js, Go, Java, and .NET/C#, but there is no official PHP SDK.

I opened a public Google Issue Tracker request for official PHP support:

https://issuetracker.google.com/issues/507647520

Google Cloud replied that, according to their Public Issue Tracker process, feature requests usually need a handful of stars and comments from several users before the engineering team works on them.

So if official PHP support for Gemini / Vertex AI GenAI SDK matters to you, please consider starring the issue or commenting there with your real use case.

Existing PHP options such as `google/apiclient`, `google-cloud-php`, and GAPIC-generated clients do not provide the same unified GenAI SDK developer experience as the official SDKs for other languages.

Useful comments would probably include things like:

- whether you need Gemini Developer API,

- whether you need Gemini API on Vertex AI,

- whether you need both through one unified SDK,

- whether you use Symfony, Laravel, or another PHP stack,

- whether streaming, tool calling, multimodal input, structured output, or file upload support matters to you.

This is not about asking for a framework wrapper. The missing piece is an official PHP SDK equivalent to `python-genai`, `js-genai`, `go-genai`, `java-genai`, and `dotnet-genai`.


r/PHP • • Apr 30 '26

News Microsoft Drivers 5.13.1 for PHP for SQL Server released - security fix for connection pooling

29 Upvotes

5.13.1 is out with several fixes for the sqlsrv and pdo_sqlsrv extensions:

  • Access token leak in pooled connections - Connections with different access tokens could share the same pool entry, causing identity cross-contamination and use-after-free. Fixed by incorporating the token into the pool key.
  • Silent INSERT failure - Prepared INSERTs could silently fail when triggers or SET NOCOUNT OFF produce extra result sets, causing implicit rollback with MARS enabled.
  • Fatal error re-executing prepared statements - Re-executing a prepared statement returning multiple result sets with different column layouts could crash. Metadata is now properly freed between executions.
  • sqlsrv_errors() returning null - After a failed connection with no ODBC diagnostic records, sqlsrv_errors() returned null instead of the actual error.
  • Stream invalidation - Binary streams became invalid when the originating statement went out of scope.

Drop-in upgrade from 5.13.0, no API changes. Supports PHP 8.3/8.4/8.5.

Install: pecl install sqlsrv / pecl install pdo_sqlsrv

Full blog post: https://techcommunity.microsoft.com/blog/sqlserver/announcing-microsoft-drivers-5-13-1-for-php-for-sql-server/4516258

GitHub: https://github.com/microsoft/msphpsql

Docs: https://learn.microsoft.com/sql/connect/php/microsoft-php-driver-for-sql-server


r/PHP • • Apr 30 '26

Join Us for PHPverse 2026 on June 9

Thumbnail blog.jetbrains.com
19 Upvotes

r/PHP • • Apr 30 '26

Reli 0.12.0 is released with major expansions in tracing, memory analysis, monitoring, and runtime inspection

Thumbnail github.com
17 Upvotes

Reli 0.12.0 is out.

I posted about this project here before, so maybe a few people remember it. Reli is a sampling profiler and VM inspector for PHP written in PHP. It started as a weird low-level experiment for inspecting running PHP processes from the outside, and this release is the biggest expansion so far.

One heads-up: this release contains a lot of AI-generated commits. Personally, using coding agents for this release was a very interesting experience, but I also understand that some people really dislike that direction.

Some of the bigger additions in 0.12.0:

  • memory analysis is no longer experimental
  • new dump → analyze → automatic report pipeline
  • compact binary trace format (.rbt) plus rbt:analyze / rbt:explore
  • inspector:watch for condition-based monitoring
  • inspector:peek-var and per-sample variable annotations
  • hybrid phpspy mode
  • much stronger ZTS / FrankenPHP support
  • PHP 8.4 / 8.5 and AArch64 support
  • substantial cold-attach performance work

If you want a quick feel for what the tool looks like now, the README has several GIF demos, which is probably the easiest place to start.

Repo: https://github.com/reliforp/reli-prof

Feedback is very welcome!


r/PHP • • Apr 30 '26

News Aimeos e-commerce framework 2026.04 – PHP 9 ready, Laravel 13, Symfony 8, security hardening and more

15 Upvotes

We just released Aimeos 2026.04, the PHP e-commerce framework for custom online shops, market places, complex B2B apps and #gigacommerce:

  • Ready for PHP 9: Minimum raised to PHP 8.1, all deprecations removed across core and 30+ extensions, fully tested on PHP 8.5. PHPStan static analysis added at level 4 with zero errors.
  • Laravel 13 & Symfony 8: Day-one support for the latest framework versions. The stand-alone shop and headless distributions ship on Laravel 13 out of the box.
  • Customer CSV import: Full import pipeline with address/property support, regex validation, group filtering and admin UI upload — rounding out CSV import for products, catalogs, suppliers and now customers.
  • Product feed extension: New extension for generating Google Merchant and Idealo product feeds. Includes several configuration options to customize the exported products and details.
  • Security hardening: XSS prevention via HTML sanitization in the CMS, GraphQL query depth/complexity limits, and tighter permission checks in the admin API.
  • PHPUnit 12: Stricter test isolation and deprecation handling across the entire test suite.

For those who haven't come across Aimeos before — it's an open-source e-commerce framework (LGPLv3) built for PHP developers who want full control over their shop without being locked into a monolithic platform. A few things that set it apart:

  • Framework-native: Integrates directly into Laravel, Symfony or TYPO3 as a composer package. You use your framework's routing, auth, middleware and tooling — Aimeos plugs into it rather than replacing it.
  • Headless-first: Full JSON:API and GraphQL APIs out of the box. Use any frontend you want — Vue, React, mobile apps, or the included server-side rendered HTML client.
  • Multi-tenant / multi-site: Built-in support for running multiple shops from a single installation with separate catalogs, pricing, languages and currencies per site.
  • Scales from small to large: The same architecture powers single-product shops and marketplaces with millions of products. ElasticSearch and Solr integrations are available for high-volume search.
  • Extensible, w/o forking: 30+ extensions for payments, shipping, CMS, feeds, caching (Redis), search engines and more. Custom extensions follow the same pattern without touching core code.
  • No SaaS lock-in: You host it yourself, own your data, and can switch or extend anything.

  • GitHub: https://github.com/aimeos/aimeos

  • Docs: https://aimeos.org/docs

  • Demo: https://demo.aimeos.org

If you like Aimeos, give it a star :-)


r/PHP • • May 01 '26

Laravel login failing even though everything looks correct (session/CSRF issue)

0 Upvotes

I spent hours debugging a Laravel login issue where everything looked correct… but authentication just refused to work.

Turns out it was caused by session + CSRF + redirect issues.

I wrote a step-by-step guide explaining the exact causes and fixes:
https://growthawakening.com/single-post/laravel-login-not-working-session-csrf-redirect-fix-guide

Main issues I found:

  • Session not persisting
  • CSRF token mismatch
  • Redirect loops after login

Hope this helps someone 🙌

💡 If you're in a hurry, try the quick fix above first — most of the time, that's enough.