1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 05:14:04 +00:00
laravel-tips/content/tips/you-can-use-first-class-callables-for-routes-in-php-81.md
2022-01-07 17:38:01 +01:00

612 B

title tweet_id thread_slug author_username images created_at slug
You can use first class callables for routes in PHP 8.1 1479467932379799552 weekly-thread-2021-01 archtechx
https://pbs.twimg.com/media/FHNP2kIVUAIqiCH.jpg
2022-01-07T15:00:16+00:00 you-can-use-first-class-callables-for-routes-in-php-81

🔥 You can use first class callables for routes in PHP 8.1

The caveat is that the methods need to be static because there's no syntax for referencing instance methods on classes

I don't use constructor DI in my apps, so static methods are fine despite feeling a bit non-standard