Source: matthewdaly.co.uk

Everything's (potentially) a callable
https://matthewdaly.co.uk/blog/2022/10/02/everythings-potentially-a-callable/'Published by at 2nd October 2022 7:30 pm I'm a big fan of callables in PHP in general.

Job classes are something else that do only one thing, and thus it potentially makes sense to use an invokable class for them.

However, as with some of the other examples, it's not clear if it supports constructor injection, so it's best to check.

There are some limitations of using invokable classes which you should bear in mind when deciding whether to make a class an invokable or not.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners