api-platform / api-pack

A Symfony pack for API Platform
https://api-platform.com
MIT License
524 stars 34 forks source link

Add NelmioCors by default #14

Closed dunglas closed 6 years ago

dunglas commented 6 years ago

Many people struggle to properly configure CORS handling when creating an API with Symfony 4. To solve this problem, this PR adds NelmioCors (that now has a dedicated Flex recipe) to the pack.

Thanks to the new Flex's unpack feature, adding an extra dependency in the pack isn't a big deal anymore, because the user can easily remove it if he wants to customize the installation.

Another advantage of this PR: it will reduce the gap between the standard API Platform distribution and composer req api.

Nyholm commented 6 years ago

Since this makes sense for most users Im all :+1:

soyuka commented 6 years ago

I'm still unsure about that because I don't see why an API could not exists without CORS, it's not a "required" feature for the api to work (at least users should know that an API doesn't need to allow cross origin request to work). Anyway, if users are having a hard time doing composer req cors, let's add it to the stack!

dunglas commented 6 years ago

@soyuka the goal of the pack is to have an "out of the box" solution handling most common cases. As api-platform/core doesn't deal with CORS at all, the user can still remove NelmioCors if he doesn't want it.

sroze commented 6 years ago

Thank you @dunglas.

sroze commented 6 years ago

Released in 1.1.0 🎆