Could #-attributes in PHP 8.1 be used for routes in the future? |
I have no clue what I am talking about so I am just dumping my thoughts here...
I have a fairly large project in CI4.2 which is a REST backend to an admin interface written as SPA JavaScript application. The Routes.php file is starting to get very long with segments like this to manage a single object in the system: PHP Code: // Routes for handling Users and Employees Especially the filter settings are hord to remember the correct syntax. Also making sure that all possible routes are covered and maintained is getting harder and harder. Refactoring is also a nightmare. So I thought: what if Attributes in the Controller itself could be used to describe the routes allowed in the Controller. Sort of lite auto-routes from before but with better maintainability. Example: PHP Code: <?php As you can see I don't have a clue if this is possible or not but I just wanted to put my thoughts in writing and possibly start a discussion. /Mattias
https://forum.codeigniter.com/showthread.php?tid=81038 CodeIgniter4 Attribute Routes
(09-21-2022, 08:22 AM)iRedds Wrote: https://forum.codeigniter.com/showthread.php?tid=81038 CodeIgniter4 Attribute Routes Cool, thanks. |
Welcome Guest, Not a member yet? Register Sign In |