@ -93,7 +93,7 @@ than have the overhead of hundreds of (unecessary) `->add(...)` function calls.
I just see very little benefit to writing hundreds of `->add(route)` commands when the entire route layout of your website can be loaded once, and visible/configurable in a single location.
I just see very little benefit to writing hundreds of `->add(route)` commands when the entire route layout of your website can be loaded once, and visible/configurable in a single location.
One argument for writing `->add(...)` calls in the Container and Router is input validation,
One argument for writing `->add(...)` calls in the Container and Router is input validation,
but I would argue that you can still do it by parsing a single pre-configured array. One large pre-configured array with default Routes and Container objects could serve as the 'base' for default options. Additional Routes/DI/IoC objects could be added/modified at run-time. Also, I ONLY use PHP array based configuration files, because they are cached natively by PHP; any other configuration files (.ini/YAML/JSON) have to be interpreted/parsed at runtime or a custom cache has to be invented.
but I would argue that you can still do it by validating the single pre-configured array. One large pre-configured array with default Routes and Container objects could serve as the 'basis' for default options. Additional Routes/DI/IoC objects could be added/modified at run-time. Also, I ONLY use PHP array based configuration files, because they are cached natively by PHP; any other configuration files (.ini/YAML/JSON) have to be interpreted/parsed at runtime or a custom cache has to be invented.
There is actually another reason I prefer this method, and that is because when all the routes are visible together, it's easier to see the overall picture, and make changes to them rapidly. I've worked on large projects with hundreds of routes before, especially with annotations, but even with function calls to add routes, it becomes a nightmare to manage. Try adding 300 different routes in 100 controllers and see how much fun you are NOT having! I swear I must have lowered my life expectancy from the nightmares.
There is actually another reason I prefer this method, and that is because when all the routes are visible together, it's easier to see the overall picture, and make changes to them rapidly. I've worked on large projects with hundreds of routes before, especially with annotations, but even with function calls to add routes, it becomes a nightmare to manage. Try adding 300 different routes in 100 controllers and see how much fun you are NOT having! I swear I must have lowered my life expectancy from the nightmares.