Re: Net_URL_Mapper or Net_URL_Router (was:Re: [PEAR-DEV] [PEPr] Proposal finished Networking::Net_URL_Mapper)
| From: | Bertrand Mansion | Date: | Fri, 02 Mar 2007 18:02:04 +0000 |
| Subject: | Re: Net_URL_Mapper or Net_URL_Router (was:Re: [PEAR-DEV] [PEPr] Proposal finished Networking::Net_URL_Mapper) | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-45778@lists.php.net to get a copy of this message | ||
Le 2 mars 07 à 18:32, till a écrit :
Not that anyone cares about what I think ;-), but I feel like this would make a great addition. If people didn't like the name, they should not have voted +1 on it? But they did, so I guess it passed. The reason why some proposed renaming the package is because of how things are already "called" in other (MVC) frameworks. Take the Zend Framework as an example, it's referenced with Zend_Controller_Front::getRouter and the like. So people would probably search PEAR for "router" instead of "mapper". By the way, Rails does the same. I *think* Symfony is also following this model. What's your concern with renaming it?In Rails and ZF and others, the router object is indeed routing: it takes the url and automatically deduces a 'controller' and an 'action', even if they were not defined in the url, then perform the action within the controller. While this is handy if you have a framework that was made to work this way, it's not very flexible because there is a lot more you can do with an url than just routing like this. Furthermore, in such frameworks, AFAIK (but I might be wrong), you always end up with urls like these: http://example.com/controller/action/arguments. This is also a limitation IMO. Net_URL_Mapper is only mapping the url to a defined set of rules and returns results when the url matches a rule. It is possible to define rules for the configuration above. But you can also go your own way and have modules, sub modules, extensions, plugins, versions, action objects, whatever you need. It's more generic. It can be used to validate and generate urls, even without controllers nor actions. It's not tied to a framework. In the end, users will be able to find the router they are after in PEAR if it is documented to be found with such keywords I think. My concern is that the term routing is limited and can lead users to think "Damn, yet another controller/action router" while it is not.