Closed kalebheitzman closed 11 years ago
Look into developing a package to handle all of that. You can define routes in a package, too.
@kalebheitzman, short andwer, no. Routes are explicit in L4, Symfony, etc, whereas they're implicit in CI, FuelPHP, Kohana etc.
Having explicit routes gives people a hell of a lot more control over their applications. The way L4's routing is architectured is that, "controllers" are actually converted into a Closure which responds to a route.
The current flow for controllers is:
GET /foo
== FooController@getIndex
).OR
Route::controller
, which gets an Inspector
object to look in the controller class for routable methods (e.g., method prefixed with 'get', 'set' etc). It then comes back and starts from Number 1 in the above list.Routing is explicit. In @cartalyst's Platform 2.0, we have implicit routing with explicit overrides. This means, we have "extensions" which you can drop into your app, and they are automatically routed for convenience. For example, GET /users/groups
may me automatically routed to a controller called Users\Controllers\GroupsController@index
. But this is application specific and may vary for your own application.
Brilliant! Love it. This was the only thing holding me back as far as switching from CI. Thanks for the help.
Love L4! This is an unconventional request/question. Is it possible to define routes inside of Controllers themselves instead of the routes.php file? Or maybe there is an answer to this: Is it possible to use a modular structure where you would have for example an Auth module/folder in the app directory. Within the auth folder there would be a config, controllers, models, views folder to add all of the different components. I'm just trying to figure out how to make my code more modular/shareable. I don't think composer is the answer to my question because it would be L4 specific.