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

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners