PHP Reddit
31 subscribers
305 photos
40 videos
25.3K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
BETA laravel-permissions-redis v4.0.0-beta.1 — Redis-backed permissions, looking for feedback

Hi ,

Maintainer of [laravel-permissions-redis\](https://github.com/scabarcas17/laravel-permissions-redis) here. Just cut v4.0.0-beta.1 and I'm looking for people to test before I cut stable.

Quick context on what it is

Spatie's laravel-permission is great and it's what most people should use. This package is for a specific case: when you're doing so many permission checks per request (think: a complex admin panel rendering 200+ ACL-gated widgets, or API gateways authorizing fan-out calls) that the DB roundtrips from Spatie become measurable latency.

All reads go to Redis. The DB is only touched on cache miss (warm) or on write (assign/revoke). Writes invalidate and re-warm via events.

What's new in v4.0*

\- Permission `group` metadata preserved in Redis — previously `PermissionDTO::group` was always null, now it's backed by a Redis hash
\- `Role::hasPermission()` — direct role-level check via SISMEMBER
\- Blade directives accept guard override: `@role('admin', 'api')`
\- Queue-backed warming (`--queue` flag on the warm commands)
\- Multi-user-models — `user_model` config accepts an array (useful for User + Admin separation)
\- UUID/ULID role IDs
\- LRU eviction in the in-memory resolver cache + warm cooldown (protects long-running workers and DB storms)
\- `TransactionFailedException` — Redis EXEC failures are observable instead of silently dropped

Breaking

`PermissionRepositoryInterface` gained 3 methods for permission group metadata. If you only use the package as a consumer (not implementing the interface yourself), no code changes required — just run `php artisan permissions-redis:warm --fresh` after upgrade.

Install the beta

composer require scabarcas/laravel-permissions-redis:\^4.0@beta

Release notes: https://github.com/scabarcas17/laravel-permissions-redis/releases/tag/v4.0.0-beta.1

Honest disclaimers

\- This is beta. Don't deploy to prod yet.
\- If your app does <50 permission checks per request, Spatie is probably simpler and fine.
\- Needs Redis. If you can't run Redis, this is not for you.

Open to feedback on: API ergonomics, the upgrade path, whether the new interface methods feel natural, anything else. Will roll feedback into beta.2 or rc.1.

Thanks!

https://redd.it/1ssz0sd
@r_php
PHP will get an AOT compiler from the Swoole team in 2027

>Swoole Compiler v4 introduces a native AOT (Ahead-of-Time) compiler that radically changes the landscape. The AOT compiler abandons traditional PHP interpretation and allows code to be compiled directly into native binary executables. Performance can increase by orders of magnitude compared to the classic interpreter, reaching levels comparable to Rust and Go.

News has appeared in the Chinese segment that Swoole Compiler 4 plans to release a real PHP AOT compiler, roughly 95% compatible with PHP. Some natural limitations like $$, eval, and extract are understandable.

We have effectively already entered the era of AOT compilation for scripting languages. Similar efforts are emerging for Python and Ruby, and TypeScript already has an AOT compiler.

What does this mean?

It means it will be possible to get rid of the PHP VM and JIT in favor of native code packages that can reach maximum performance. It also means that, in the future, PHP may have multiple runtime environments. And it means that if moving to a compiled language is not part of your plans, you risk being left behind.

I urge the entire professional community to take this trend seriously.

https://mp.weixin.qq.com/s/05I3xe4pgRJufSBG-8Gz6w

https://redd.it/1stb4o3
@r_php
Would you be interested in a Laracon Canada?

I’m exploring the idea of a possible Laracon Canada and put together a short interest form to gauge whether there’s enough support to make it happen.

If you’d be interested in participating as an attendee, speaker, sponsor, or organizer, I’d love your input:

**https://laracon.ca**

The form asks about:

where you’re based in Canada
which city you’d be most likely to attend in
what time of year works best
how you’d want to be involved

This isn’t an official announcement, just an attempt to measure real interest and see what a Canadian Laracon could look like.

If this sounds like something you’d want to see, please fill it out and share it around.

https://redd.it/1stm2n7
@r_php
Open source AST-based code transformation tool for PHP and MCP/automation workflows

I've been working on an open-source tool called **Morfx** and just shipped the first public release.

GitHub:
[https://github.com/oxhq/morfx](https://github.com/oxhq/morfx)

Release:
[https://github.com/oxhq/morfx/releases/tag/v0.1.0](https://github.com/oxhq/morfx/releases/tag/v0.1.0)

The idea is to make automated code edits safer and more targeted.

A lot of AI/code automation workflows still rely on string replacement or full-file rewrites. Morfx is meant to work at the AST level instead, so you can target a specific function, method, class, or file pattern more deterministically.

For PHP specifically, that means things like:

* targeting a single controller method
* replacing or appending code in a scoped way
* querying syntax nodes instead of grepping text
* keeping risky changes stageable/reviewable before applying them

The project exposes the engine through:

* an MCP server
* standalone JSON tools

I think PHP is an especially good fit for this kind of tool because a lot of real-world codebases are large, long-lived, and sensitive to broad automated rewrites.

I'd be interested in feedback on:

* whether this solves a real PHP/Laravel pain point
* what PHP refactor/use cases would matter most
* whether the MCP angle is compelling or if the standalone tools are more useful

Happy to answer technical questions or hear where this falls short.

https://redd.it/1stu8f5
@r_php
In a Symfony + API Platform project with hexagonal architecture, where do you put validation and how do you handle the DTO vs Command boundary?

I'm trying to figure out the right trade-off between three approaches for write operations. My setup: single-channel HTTP only, synchronous Symfony Messenger bus, no async, no multiple delivery channels.



Approach 1: Separate Input DTO + Command

DTO in Infrastructure with Symfony validator constraints, Processor translates to Command, Command is a pure POPO with no framework dependencies.



Approach 2: Command as API Platform input directly

No separate DTO, validation constraints live on the API resource class, Command stays a pure POPO with zero Symfony/API Platform annotations, Processor enriches with HTTP context

(authenticated user, etc.) before dispatching.



Approach 3: Handler directly as Processor

No Command at all, Handler implements ProcessorInterface, shortest path but Application layer explicitly depends on Infrastructure.

So what approach you recommand please :)





https://redd.it/1stxn44
@r_php
TreeTrek: PHP web app for browsing raw Git repos
https://repo.autonoma.ca/treetrek

https://redd.it/1stw12y
@r_php