I would like to avoid static methods, they are harder to test.
I prefer something (very basic example) like this

https://gist.github.com/damianopetrungaro/d3da280e20bd5b22c09c64174114ac2a

We should also discuss if is better to call the "add" method or "map".
I don't know which one is the most diffused.

I imagine like some interfaces like:
RouteInterface as representation of the single route,
RouterInterface as collector of Routes,
RouteMatcherInterface as object that can contains more RouterInterface that 
will match and dispatch the action.

On Thursday, November 17, 2016 at 11:34:46 PM UTC+1, Woody Gilk wrote:
>
> To me, the expressive implementation goes way beyond what a router does, 
> which is:
>
> Map an http method and a URI expression to a callable:
>
> Router::add(method, urix, callable)
> Router::get(urix, callable)
> Router::post(...)
> // etc for http methods
>
> And then match a URI to a registered route:
>
> Router::match(uri) : Route
>
> Middleware is a totally separate thing and I think it's weird to put it 
> here. Especially since middleware can do routing for you, no need for a 
> separate step.
>
>
> On Thu, Nov 17, 2016, 16:08 Matthew Weier O'Phinney <mweiero...@gmail.com 
> <javascript:>> wrote:
>
>> On Thu, Nov 17, 2016 at 3:12 PM, Damiano Petrungaro
>> <damianop...@gmail.com <javascript:>> wrote:
>> > I'm doing a microframework (for educational purposes), with the goal of 
>> use
>> > in the core only methods derived from the PSR interfaces, so as to give
>> > maximum flexibility and not be bound to an implementation rather than
>> > another.
>> >
>> > Now i'm thinking about a routing system, and i'm wondered, how a so 
>> crucial
>> > component to web applications (used by all the frameworks) haven't a
>> > standard.
>> >
>> > What do you think to propose it as a possible PSR?
>>
>> With Expressive, we've actually started down this direction already,
>> and Michael has been urging me to submit our ideas around this as well
>> as templating as potential recommendations.
>>
>> Maybe take a look at zend-expressive-router and its RouterInterface,
>> Route class, and RouteResult as a place to start?
>> (https://github.com/zendframework/zend-expressive-router)
>>
>> I'm certainly willing to discuss!
>>
>>
>> --
>> Matthew Weier O'Phinney
>> mweiero...@gmail.com <javascript:>
>> https://mwop.net/
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "PHP Framework Interoperability Group" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to php-fig+u...@googlegroups.com <javascript:>.
>> To post to this group, send email to php...@googlegroups.com 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/php-fig/CAJp_myW7zjLEFRhaNg4Qtz9gLFf4JWpfXwZcK2wszLCuiKS3Rw%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
>
> Woody Gilk
> http://about.me/shadowhand
>

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to php-fig+unsubscr...@googlegroups.com.
To post to this group, send email to php-fig@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/2d837646-e3bd-4735-b8ce-ac269bbca9a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to