Maravel-Framework 10.70: Callable Arrays in Queues
Version 10.70 will introduce the ability to dispatch standard PHP callable arrays directly to the queue (e.g., [Service::class, 'method']).
Advantages:
Avoids unserialize(): Completely bypasses the need to serialize and unserialize closures or full object instances. This eliminates serialization bugs, reduces execution overhead, and removes the security risks natively associated with PHP's unserialize().
Reduced Payload Size: Only the class string and method name are stored in the queue backend (Redis, database, etc.), drastically cutting down payload size compared to serialized objects or large closures.
Fresh Container Resolution: The queue worker instantiates the class directly through the Dependency Injection container at the exact moment of execution. This guarantees the job runs with the latest application code and avoids stale state issues caused by saving an object's state at the time of dispatch.
No Boilerplate: Allows you to execute background logic directly from existing service classes, removing the need to create and maintain dedicated Job classes for simple operations.
Discover more https://github.com/macropay-solutions/maravel-framework/pull/69


Replies