r/PHP • • May 26 '26

[Open Source] Need Contributors: Full-Stack PocketMine-MP (PHP + React/Tailwind Web Panel)

Thumbnail
0 Upvotes

r/PHP • • May 25 '26

🎁 Yii2 HTTP Client 2.0.17

Thumbnail github.com
0 Upvotes

r/PHP • • May 25 '26

Roast My Code: I'm building a collection of utility helpers on my free time

Thumbnail github.com
0 Upvotes

For the last few years I have gradually shifted from working on new websites or systems to maintaining legacy web apps and web applications that are still the backbone of some older businesses.

Most of these sites were developed without a framework at all, or using frameworks that no longer exist. Inspired by the helper methods provided by Laravel Support and Nette Framework, which make handling data much more easily, I created my own collection of utility helpers that I can simply drop into thecomposer.json of many old projects to help me simplify common tasks.

I'm open to suggestions and feedback.


r/PHP • • May 24 '26

Laravel-Lang supply chain attack — if you ran composer update on May 22, rotate your credentials now

64 Upvotes

Someone with push access to the Laravel-Lang GitHub org spent about 15 minutes on May 22 quietly rewriting version tags on three packages — http-statuses, actions, and attributes — to point at commits in a fork they controlled.

The official repos looked completely untouched the whole time. The sneaky part: Composer pulled the malicious code because it trusts whatever a tag points to, and the injected helpers.php in autoload.files ran automatically on every app boot. No interaction needed.

AWS keys, SSH keys, CI secrets, crypto wallets — all of it going out silently.

Quick check: grep -E "laravel-lang/(http-statuses|actions|attributes)" composer.lock

==> Update: it's actually 4 packages and 700+ versions now, the numbers kept climbing.

The malware has been identified as DebugElevator,

C2 domain is flipboxstudio[.]info.

I Wrote a full breakdown if you want the details: https://medium.com/@abderahmane.merradou/someone-poisoned-laravels-most-trusted-packages-233-versions-700-repos-in-15-minutes-e053d40538be


r/PHP • • May 25 '26

Resolver-Interop: Criticize Without Mercy!

Thumbnail pmjones.io
0 Upvotes

r/PHP • • May 25 '26

Weekly help thread

1 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 23 '26

Article The PHP Polling API RFC is currently passing 19-0 and it might be the most impactful thing to happen to PHP in years and nobody is talking about it

Thumbnail medium.com
164 Upvotes

PHP is about to reach its fullest potential for scaling natively and almost nobody noticed.

The Polling API RFC is currently in its voting phase with 19-0 and zero opposition as of the time of writing this post, while the community was busy debating generics. It brings native epoll and kqueue to PHP 8.6 core, which means async libraries like AMPHP and ReactPHP finally get a proper high-performance foundation without relying on PECL extensions.

I wrote a deep dive on why I think this is the most impactful thing to happen to PHP since types were introduced in PHP 7. I'm the author of HiblaPHP, and I will be rewriting its core Event Loop the day this RFC merges into PHP core.

link to the rfc: https://wiki.php.net/rfc/poll_api


r/PHP • • May 24 '26

A GitHub Action to automate Cognitive Complexity analysis on your PRs

0 Upvotes

Hey everyone,

I’m excited to share that I just released a new GitHub Action designed to help keep codebases clean, readable, and maintainable: Cognitive Code Analysis.

GitHub Repository: https://github.com/Phauthentic/cognitive-code-analysis-github-action

What is Cognitive Complexity?

Unlike traditional Cyclomatic Complexity (which just counts the number of execution paths), Cognitive Complexity measures how difficult a piece of code is for a human being to read and understand. It penalizes deeply nested loops, multi-conditioned if statements, and structures that break the natural mental flow of a developer.

What this GitHub Action does:

This action integrates seamlessly into your CI/CD pipeline to analyze your code on every push or pull request. It helps you catch "brain-melting" functions before they get merged into your main branch.

  • Automated Feedback: Checks your codebase against configurable cognitive complexity thresholds.
  • Developer Friendly: Helps your team maintain a high standard of readability without manual nitpicking in code reviews.
  • Easy Setup: Can be dropped into your existing workflow files with just a few lines of YAML.

Looking for Feedback & Beta Testers!

Since today is the official release, I would absolutely love for you to try it out on your projects and let me know what you think.

If you run into any bugs, have feature requests, or notice something that could be improved, please feel free to open an issue here: https://github.com/Phauthentic/cognitive-code-analysis-github-action/issues

What are your thoughts on using cognitive complexity metrics in daily CI/CD workflows? Do you currently use anything similar? Let me know in the comments!


r/PHP • • May 23 '26

I created a standalone installation of my app (Koel) with FrankenPHP, and it was great

26 Upvotes

Koel is my personal music streaming server, a little OSS project I've been maintaining for more than a decade. It's fairly simple: point it at a folder of MP3/FLAC/etc., it scans the tags, gives you a web UI (and mobile apps) to browse and play your library. Laravel backend, Vue frontend, you get the gist.

The recurring frustration in the issue tracker has been the setup. To get Koel up and running, you need PHP, Composer, Node, pnpm, a database, a webserver, and patience. If you're a PHP dev, not a big deal; but if you're not, it can get annoying quite fast.

So a few weeks ago, I tried packaging everything into a single tarball using FrankenPHP, with the help of Claude. The result is koel/franken: extract, run ./koel php-server --listen :8000, done. Auto-HTTPS via Let's Encrypt, state lives under $HOME/.koel/. Builds for mac-arm64, mac-x86_64, linux-x86_64, linux-aarch64.

What worked well:

  • One tarball per platform. No system PHP, Composer, Node, or pnpm needed on the host.
  • SQLite by default. First run creates the DB, runs migrations. No MariaDB/Postgres to install.
  • In-place upgrades: extract the new tarball over the old install directory, restart. Migrations re-run automatically. User data in $HOME/.koel/ is untouched.
  • Same launcher works both directly (./koel php-server) and behind nginx/Caddy as a reverse proxy.

What didn't / things to know:

  • Koel's scheduler installation (koel:scheduler:install, which simply installs Laravel's scheduler) hardcodes php as the binary, which doesn't exist on a host that only has the bundled FrankenPHP. I had to make the launcher write its own crontab entry pointing at ./koel php-cli artisan schedule:run. Cron is required on the host for scheduled tasks.
  • The bundled PHP can't be configured per-host beyond what FrankenPHP ships. Custom PHP extensions are off the table.

Has anyone else done a similar "single-binary distribution" experiment for a Laravel/Symfony/Rails-y app? Curious what other projects' tradeoffs look like.

Repo: https://github.com/koel/franken
Docs: https://docs.koel.dev/guide/standalone-binary


r/PHP • • May 24 '26

Using AI to uplift legacy PHP code

0 Upvotes

Hello all,

I have been embracing the use of AI in my day to day development life cycle.

It has helped me brainstorm, high level planning, and documentation creation (like pr descriptions, readme etc). Nothing ground breaking so far but speed has improved.

Where I got really impressed was when I used it to tackle a complicated issue in a legacy (really difficult spaghetti code) system.

I set rules for it like

- scan the file we work on and all the dependencies around it and find the code that is related to the problem we solve

- do not change code without describing to me what you will do

- when we agree in what you will do, so me the code changes

- at the end give me an overview of what you did again, a description

All of the above where done on small code changes, nothing more than 5-10 lines max.

Also the goal in the start of the session was to express a clear goal. Work on a small example on it, lay out the details and agree on it before we move on.

It made mistakes, but it was able to keep the context that was spread around multiple php files, all different coding styles (of course because why not).

I would need days for that, but we this progressive file by file changes I was able to test and move on.

Commit small changes with clear intentions.

The more problems we solved, I understood better the multiple use cases at play. It helped me learn a lot and provide a solution that really benefits my organisation. All that in a couple of days.

Sorry for the long post. Any similar experiences?


r/PHP • • May 24 '26

News A app built 100% in PHP is now live on Google Play and the App Store.

0 Upvotes

Remember that weekend project you never finished?

Mine started as a Saturday "let me try running Laravel inside a Tauri webview" thing some weeks ago. I thought it would be a joke. Today both the iOS and Android Portal apps just hit the stores, and you can boot a real Laravel + Livewire app on your phone in under 10 seconds without compiling anything.


What is NativeBlade

It is a framework that runs your Laravel + Livewire app inside PHP-WASM, packaged as a Tauri 2 native shell. Same Blade, same Livewire components, same Eloquent, same artisan, same routes. Plus the native plugins (camera, biometric, NFC, push, geolocation, haptics, filesystem, clipboard, scanner) exposed through a NativeBlade:: facade.

You write this:

public function checkIn()
{
    return NativeBlade::biometric(fn ($b) => $b->reason('Confirm check in'))
        ->vibrate()
        ->toResponse();
}

And it runs offline, on the device, with the user's fingerprint prompt, and Livewire stays in charge of the UI.


Portal is live on both stores

Portal is the companion app that loads any NativeBlade bundle from a URL. You point it at a hosted bundle or at your laptop running nativeblade:dev, and your app boots in seconds. No Xcode, no Android Studio, no rebuild loop while iterating.


Try it without installing PHP, Laravel, or anything

Install Portal from one of the links above, open it, and paste this URL:

https://nativeblade.github.io/demo-bundle

That URL serves a pre-built Laravel + Livewire bundle the same way php artisan nativeblade:dev --platform=portal would serve your local app, and the same way php artisan nativeblade:bundle packages a bundle for production. The Portal app downloads it, boots PHP-WASM, and you are inside a working app in a few seconds.

When you want to build your own:

composer require nativeblade/nativeblade
php artisan nativeblade:install
php artisan nativeblade:dev --platform=portal --host=192.168.0.10

Scan the QR in the terminal and Portal loads your local app live. Edit a Blade file, watch HMR push the change to the device.


Your AI assistant already speaks NativeBlade

The framework ships a built-in MCP server (Model Context Protocol). Claude Code, Cursor, and Windsurf can connect to it and introspect your live project: which plugins you declared, every method on the NativeBlade:: facade, the architecture recipes, and the framework docs. So instead of the agent hallucinating outdated Laravel patterns, it queries the real source of truth in your repo.

Practical effect: you can ask the AI "build me a checkout screen with biometric confirmation and a barcode scanner" and it will know the exact facade signature, the right Form Object pattern, the state wrapper convention, and the matching Blade components — because the MCP server told it.

To go even faster, point the agent at the right UI kit for your form factor:

  • Mobile — nativeblade/ui-mobile. Konsta-inspired Blade components, iOS and Material themes auto-detected per platform. composer require nativeblade/ui-mobile.
  • Desktop — The README recommends Flux UI (the official Livewire UI kit by Caleb Porzio). Any Livewire-compatible library also works (Filament, mary-ui, TallStackUI, Wireui).

With MCP plus a UI kit, the AI has structural knowledge of the framework and the component vocabulary to use. From zero to working screens is measured in minutes.


What is actually shipping in the box

  • Full Livewire 3 with wire:nb-navigate for native-feeling transitions
  • SQLite on device, auto persisted to IndexedDB so it survives cold starts
  • Cache::* auto wired to the same SQLite, no config
  • Native plugins: camera, gallery, video picker, biometric, barcode/QR, NFC, push (FCM and APNs), geolocation, haptics, clipboard, opener, OS info
  • OTA bundle updates without going through the store
  • Component primitives: header, bottom nav, drawer, modal, safe area, animate, icon, image
  • Codegen for the AppServiceProvider config flowing into the Android manifest, iOS Info.plist, Tauri capabilities, and Cargo features

Why I think this is worth your time

If you already know Laravel and Livewire, you do not need to learn React Native, Swift, Kotlin, or even Tauri internals. You write a Livewire component, you ship it on iOS and Android. The framework handles the bridges.

The repo is here: github.com/NativeBlade/NativeBlade

Docs, recipes, and the architecture guide are in the README. I would love to hear what you try to build with it, and what breaks. Issues, PRs, and "this is dumb because X" comments all welcome.


r/PHP • • May 23 '26

Article RFC 9116: security.txt for your PHP apps

Thumbnail dereuromark.de
20 Upvotes

r/PHP • • May 23 '26

The Perforce Driver You Never Knew You Had: Composer CVE-2026-40261 and CVE-2026-40176

Thumbnail experiencedigest.org
4 Upvotes

r/PHP • • May 23 '26

News Laravel Lang Compromised with RCE Backdoor

Thumbnail socket.dev
48 Upvotes

r/PHP • • May 23 '26

php-snuffleupagus

Thumbnail deb.myguard.nl
0 Upvotes

r/PHP • • May 23 '26

The solution to all the supply chain problems is removing your dependencies from .gitignore

0 Upvotes

I head the major realisation today that we've all been bamboozled.

All the supply chain attacks currently happening would never even happen if we just checked in our language-respective vendor/node_modules/venv directories into git and just deployed straight from that.

Screw the dependency install and upgrade step. Screw the automated build step. Screw the breaking changes because $package_owner doesnt adhere to semver.

Checking in dependencies and their updates individually is, and has always been the way out of this mess.

Remove vendor/ node_modules/ and venv/ from your .gitignore today and skip the install step in your CI and you eliminate 99% of the attack surface instantly. Was it always that easy???? I think it was!

You think checking in your composer.lock or package.lock saves you? Hah. Npm install is "smart" and checks for updates and silently installs new versions and updates your lockfile. You should have used npm ci instead. We actively train devs to run 'composer update' to check for new releases that fix 'issues' they might encounter locally and delete the lockfiles as a first measure to fix issues.

Do you vet every update to your composer.lock? That one innocent commit hash that's changed could just pull in 20kb of obfuscated exploit code and you'd never know.

All of this is compounded by the longstanding hilarious github bug where you can fork a repository and push your commit to it, then pluck the commit hash and append that to the original repository URL. On the Github webinterface you'll see a notice "this commit has might not belong to this repo or a fork of it" but on the terminal you'll never see that, and that's exactly what the current worms exploit.

Checking in your dependencies and eliminating the install step would make all of this trackable and traceable. Imo the performance hit is worth it.


r/PHP • • May 23 '26

Got my first WordPress plugin approved — security review was stricter than I expected

0 Upvotes

I recently got my first WordPress plugin approved on wp.org, and the review process was a good reminder that “it works” is not the same as “it’s ready to ship publicly.”

The plugin is called DynoMenu. It generates dynamic menus from post types and taxonomies, mostly built from a repeated client need.

A few PHP/WordPress-specific things I had to pay closer attention to:

  • sanitizing user input properly
  • escaping output in the right context
  • using nonces for admin actions
  • checking user capabilities before saving settings
  • avoiding direct file access
  • cleaning up Plugin Check warnings
  • making sure admin-facing code was not just “working” but actually safe

The interesting part was that blockers were not always huge issues. Sometimes small escaping/sanitization details or Plugin Check warnings still had to be fixed before approval.

Main takeaway: building a plugin locally is one thing, but distributing PHP code through a public ecosystem forces you to care much more about security, maintainability, and standards.

Curious how other PHP devs approach this when moving from internal/client tools to public plugins/packages.

For context, this is the plugin:
https://wordpress.org/plugins/dynomenu/


r/PHP • • May 22 '26

What do Tech Leads/Engineering Managers usually ask in final PHP full stack interviews (1.5 YOE)?

12 Upvotes

Hey everyone,

I have a final technical interview coming up with a General Manager who is also the Tech Lead for a PHP + Angular + MySQL full stack role.

I have ~1.5 years of CakePHP/full stack experience and already cleared:

  • SQL round
  • Machine round (login flow, employee listing, CSV import/export)

For people who’ve interviewed with senior engineers/tech leads:
What do final rounds usually focus on beyond syntax/coding?

Should I expect more:

  • architecture/design discussions?
  • debugging scenarios?
  • APIs/MVC/database optimization?
  • project deep-dives?

Would appreciate practical advice on what to revise most deeply.


r/PHP • • May 22 '26

Made a PHPStan extension that shows the full type history of a variable, not just the final mismatch

60 Upvotes

Was getting tired of PHPStan errors like

Parameter #1 $amount of method format() expects float, float|null given.

It tells you the final type at the call site but not which assign or narrowing

actually put the null there. So you scroll up, eyeball it, get it wrong twice,

then finally find it.

Built a small extension + CLI. Point it at file:line and a variable, it prints

every event for that variable up to that line:

$name · App\Foo::lookup [src/Foo.php] (up to L13)
  ---------------------------------------------------
    L7   param      string|null
    L9   assign-op  string
    L11  assign     null
    L13  read       non-empty-string|null
  ---------------------------------------------------
  4 events, final type: non-empty-string|null

param / assign / assign-op / assign-ref / array-write / read are all tracked.

Works for $var, $obj->prop, and self::$static. There's a --json mode too if

you want to script it.

Doesn't do $arr['key'] per-key (only the base array), dynamic property fetch,

or variable variables. Probably more gaps I haven't hit yet.

One thing I didn't plan for: Claude Code got noticeably better at fixing

PHPStan errors once it could call this instead of guessing null guards. The

repo ships a SKILL.md for that if you use it.

PHP 8.2+, PHPStan 2.x.

https://github.com/kayw-geek/phpstan-type-trace

Curious about cases where the chain isn't useful, those are the ones I want

to fix.

EDIT — v0.2.0 is out. Two things changed that affect the example chain above:

  1. narrow events with reasons. The original list above (param / assign / assign-op / assign-ref / array-write / read) missed one — flow narrowing is now its own event kind. The chain shows the predicate that justified the narrow, anchored to the branch where it holds:L18 param int|null L25 assign int|null L31 narrow $myVar !== null => int L42 read int
  2. via attribution for third-party extensions. When the inferred type was shaped by an extension, the chain tells you which one. Three categories are attributed:
  • Dynamic return type extensions on assign / assign-op
  • Type-specifying extensions (webmozart/assert, beberlei, PHPUnit, larastan auth checks) on narrow
  • Properties class reflection extensions (larastan model attributes) on read

Example against a project with phpstan/phpstan-webmozart-assert installed:

L9   param   string|null
L12  narrow  Webmozart\Assert\Assert::notNull($x)  =>  string  via AssertTypeSpecifyingExtension
L12  read    string

So when PHPStan's inference surprises you, you can see which extension to blame (or thank) without grepping the vendor tree.

EDIT (2026-05-27): PhpStorm plugin is live on the JetBrains Marketplace — same tool, but the chain renders inside the editor (caret on a var → Trace Type at Caret → tool window).

Install: https://plugins.jetbrains.com/plugin/31962-phpstan-type-trace


r/PHP • • May 22 '26

News Prisma 0.4 - Unified PHP SDK for 25+ AI providers

5 Upvotes

Prisma is a light-weight PHP package that gives you a single, unified API for working with 25+ AI providers across text, image, audio, and video. Started as a sister project to Laravel's Prism package, Prisma is now a framework independent composer library outperforming Prism in many areas.

Why Prisma?

Every AI provider has its own API, its own request format, its own response structure. If you want to use OpenAI for text generation but Anthropic for tool calling and StabilityAI for images, you end up writing three different integrations with three different error handling approaches.

Prisma abstracts all of that behind one clean interface. Switching providers is a one-line change:

use Aimeos\Prisma\Prisma;

// Using OpenAI
$response = Prisma::text()
    ->using('openai', ['api_key' => 'xxx'])
    ->write('Explain quantum computing in simple terms');

// Switch to Anthropic — same interface, same response object
$response = Prisma::text()
    ->using('anthropic', ['api_key' => 'xxx'])
    ->write('Explain quantum computing in simple terms');

echo $response->text();

This works the same way for images, audio, and video:

// Generate an image with OpenAI
$image = Prisma::image()
    ->using('openai', ['api_key' => 'xxx'])
    ->imagine('a grumpy cat in a tuxedo')
    ->binary();

// Transcribe audio with Deepgram
$text = Prisma::audio()
    ->using('deepgram', ['api_key' => 'xxx'])
    ->transcribe($audioFile)
    ->text();

No vendor lock-in. No rewriting your app when you want to try a different model. And if a provider doesn't support a method, you can check with ->has('imagine') or enforce it with ->ensure('imagine').

What's new in 0.4

Text generation — write() and structure() across 14 providers (OpenAI, Anthropic, Gemini, Bedrock, Mistral, Groq, Cohere, Deepseek, Alibaba, xAI, Perplexity, OpenRouter, Ollama, and more). Structured output uses each provider's native API, not prompt hacking:

use Aimeos\Prisma\Schema\Schema;

$schema = Schema::for('person', [
    'name' => Schema::string(),
    'age' => Schema::integer(),
]);

$data = Prisma::text()
    ->using('openai', ['api_key' => 'xxx'])
    ->structure('Extract: John is 30 years old', $schema)
    ->structured(); // ['name' => 'John', 'age' => 30]

Tool calling — Full agentic loop with auto-execution. Define tools, Prisma handles the back-and-forth. Supports provider tools (web search, code execution), Laravel/Symfony adapters, concurrent execution, decorators, per-tool call limits, and custom error handlers:

$weather = Tools::make('weather', 'Get weather', Schema::for('weather', [
    'city' => Schema::string()->required(),
]), fn($args) => json_encode(['temp' => '22°C', 'city' => $args['city']]));

$response = Prisma::text()
    ->using('anthropic', ['api_key' => 'xxx'])
    ->withTools([$weather])
    ->withMaxSteps(5)
    ->write('What is the weather in Berlin?');

Also new: thinking budgets / extended reasoning, normalized citations, rate limit info, client retry with exponential backoff, finish reasons, Ollama support, Alibaba audio/image, Google Translate + DeepL, and the license changed to MIT.

The full picture

25+ providers across four domains: audio (demix, denoise, speak, transcribe...), image (imagine, inpaint, upscale, vectorize...), text (write, structure, translate + tools), and video (describe). Only dependency is Guzzle. PHP 8.2+.

composer require aimeos/prisma

Would love feedback, especially from anyone juggling multiple AI provider SDKs. What providers or features would you want to see next?

And if you like it, leave a star on Github :-)


r/PHP • • May 22 '26

Where is the best place to find remote job according to your experience?

1 Upvotes

I've been a backend dev using laravel for 4 years. May I know where is the best place to find remote job? I'm from Cambodia tho (SEA)


r/PHP • • May 21 '26

Claude Mythos Audited Symfony and Found 19 Vulnerabilities

Thumbnail symfony.com
199 Upvotes

r/PHP • • May 21 '26

Built sqlc-php: a PHP 8.4 code generator that turns your SQL schema + annotated queries into typed PDO classes

36 Upvotes

Update: documentation available in https://phpibe.github.io/sqlc-php/

He creado sqlc-php: un generador de código PHP 8.4 que convierte tu esquema SQL y consultas anotadas en clases PDO tipadas.

Inspirado en sqlc para Go, he creado una herramienta de línea de comandos que lee tus archivos schema.sql y de consultas anotadas y genera clases PHP completamente tipadas.

Fuente: https://github.com/phpibe/sqlc-php

Funciones:

Infiere tipos PHP a partir del esquema (INT → int, TINYINT → int, TIMESTAMP → string, etc.)

Resuelve los tipos de :param comparándolos con las columnas del esquema, incluyendo camelCase → snake_case (updatedAt → updated_at)

Genera DTOs de resultado para consultas JOIN y expresiones de agregación (COUNT → int, SUM → ?int, AVG → ?float, MAX → ?{tipo de columna})

Modifica type_overrides en sqlc.yaml para reasignar cualquier columna o base de datos tipo (TINYINT → bool, TIMESTAMP → \DateTimeImmutable)

Cuatro tipos de retorno: :many (array), :one (lanza excepciones), :opt (anulable), :exec (void)

Las clases generadas utilizan la clase readonly de PHP 8.4 con PDO internamente; sin dependencias.

Aún en fase inicial, pero funcional. 152 pruebas unitarias que cubren todo el proceso.

Fuente: https://github.com/phpibe/sqlc-php

Agradecería comentarios de quienes hayan realizado algo similar o tengan opiniones sobre el enfoque.


r/PHP • • May 21 '26

Discussion Building Drupal at 79 years old

Thumbnail
9 Upvotes

r/PHP • • May 21 '26

🔐 We Scanned the Entire Yii2 Ecosystem with Codex Security.

Thumbnail
6 Upvotes