zendframework / zend-expressive

PSR-15 middleware in minutes!
BSD 3-Clause "New" or "Revised" License
711 stars 197 forks source link

Why no support for Symfony routing component? #331

Closed rparsi closed 8 years ago

rparsi commented 8 years ago

Why are zend developers homebrewing a lot of things instead of using existing components? I looked at the composer.json file, looks like all custom code.

Ocramius commented 8 years ago

Pretty much all of the routers are external existing components.

See for example:

The symfony router is (as far as I know) tightly coupled with the request context, which in turn is depending strictly on symfony/http-foundation, which isn't really compatible with the newer PSR-7 http request interfaces.

If you still want symfony routing in an expressive app, that is feasible, but you will need to translate PSR-7 <-> symfony/http-foundation everywhere.

weierophinney commented 8 years ago

@rparsi As @Ocramius noted, you're working on a flawed assumption; we are, in fact, re-using existing components always, and creating bridge components where required (which is likely the "homebrewing a lot of things" you're referring to; it's anything but). To date, we support:

We typehint on:

My point is: the interfaces exist precisely to allow code re-use from existing projects, and any bridge components we have are simply wrappers around those components to implement the interfaces. It's not invention, despite your first impression.

We have not provided bridges to many symfony components as they typically are not readily adaptable:

I'll note that we do integrate with Twig already, via zend-expressive-twigrenderer.

If you're interested in using the symfony router, and have the knowledge of the PSR-7 bridge, we would definitely welcome it. We can either document a third-party package, or fork that package into the zendframework organization (with permission, of course!).

rparsi commented 8 years ago

@Ocramius @weierophinney Thanks for the clarification. When I saw that Twig is supported but not the Symfony routing (for example) I got confused.

harikt commented 8 years ago

Let me correct something.

The symfony router depends on the symfony HttpFoundation

The assumption is wrong : https://github.com/symfony/routing/blob/c3e23ecf76e4c71a9ac3162c3ebc1e25d8e285de/composer.json#L18-L20 though it can depend on the HttpFoundation .

From the symfony routing docs :

The RequestContext parameters can be populated with the values stored in $_SERVER, but it's easier to use the HttpFoundation component as explained below.

But as everyone mentioned here, @rparsi you can write a bridge like any other router found here.