ezimuel / zend-expressive-api

Web API skeleton using zend-expressive
59 stars 30 forks source link

add REST middleware interfaces. #1

Closed abacaphiliac closed 8 years ago

abacaphiliac commented 8 years ago

hi @ezimuel , great presentations today and yesterday.

what do you think about these interfaces? if they are useful, do you think they belong here or in another package?

ezimuel commented 8 years ago

@abacaphiliac thanks for your feedback! Why do you think these interfaces will help the skeleton? I would like to keep the code simple and open at the same time, I think adding such interfaces can limit this possibility.

abacaphiliac commented 8 years ago

@ezimuel i usually feel more comfortable implementing methods against an interface. it guides my implementation. without such interfaces i may have to discover through trial-and-error that i have messed up an invoke or some other middleware method signature. i hope someday soon we will have a psr-7 middleware interface.

of course the code works without such interface declarations, like the Feature interfaces in ZF2's modules. but i usually add those interfaces to my Module anyways because it is more explicit, and i can code generate required the method signatures in my editor.

these interfaces are coupled to the server request, which can definitely be limiting. perhaps others that rely on the parent request interface would also be appropriate. in what ways do you feel such interfaces would be limiting? i do see how a bunch of optional interfaces could be noisy.

abacaphiliac commented 8 years ago

please don't feel bad if you think this is not a good idea for your api skeleton. i'll happily close the request : )

ezimuel commented 8 years ago

@abacaphiliac I agree with the usage of interfaces for drive others implementation but I don't think in this case will help a lot. Even because the interface of middleware is always the same ($request, $response, $next = null). Thanks anyway for your proposal, really appreciate.