Closed neomerx closed 9 years ago
@barryvdh Haven't you thought about supporting PSR-7 in your CORS package as Symfony and Laravel support it since recently? This package supports PSR-7 and I quickly respond to questions and PRs.
I would appreciate some feedback from you.
Well yeah, but https://github.com/asm89/stack-cors is based on StackPHP so also works on Laravel + Symfony.
And PSR-7 still needs conversions, so you would need the PSR7 message bridge + diactoros. And it didn't work 100% okay with middleware yet, because there is no defined interface for the response object.
So I like the idea of PSR-7 for CORS, but don't see the benefit for Laravel yet.
@barryvdh The package uses 3 methods from PSR-7 and doesn't depend on responses interface
Also it could be easily integrated with StackPHP. You can see it in the front page sample
Ehh, so your package doesn't add actually add the headers in the middleware?
@barryvdh Nope. It's designed to implement all the CORS logic with as little dependencies as possible. It analyzes the Request (with these 3 simple methods) and returns the analysis result with array of CORS headers to be added.
@barryvdh I've started developing Service Provider for Laravel. I can send you a link when early version is ready.
@barryvdh I would prefer it to be a part of a project with good documentation and community rather than re-creating something very similar. Your underlying project hasn't been updated for more than a year. It's abandoned and needs replacement.
Yeah but it's not like ths CORS spec changes much ;)
You just have forgotten your own PR to this project. It's still not merged :wink:
@barryvdh As promised send you a link to Laravel integration. I have looked to your code and got a question. Why did you decide you need 'route level' support in your middleware? CORS is designed to be transparent and compatible to non CORS services so you could've left it for top level middleware only.
Because you could possibly want to allow cors for just your /API routes, not your normal routes.
@barryvdh Anyways I hope I have dispelled your doubts that this package can do CORS without overhead. So you if you are interested to work with maintainers who maintains their projects and in posibility to migrate to PSR-7 in no time you are welcome :wink:
Definitely as a separate project. Possible integration