Add NelmioCors by default by dunglas · Pull Request #14 · api-platform/api-pack · GitHub
Skip to content

Add NelmioCors by default - #14

Merged
sroze merged 1 commit into
api-platform:masterfrom
dunglas:cors
Feb 9, 2018
Merged

sroze merged 1 commit into
api-platform:masterfrom
dunglas:cors

Conversation

@dunglas

@dunglas dunglas commented Feb 9, 2018

Copy link
Copy Markdown
Member

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

Nyholm commented Feb 9, 2018

Copy link
Copy Markdown

@soyuka

soyuka commented Feb 9, 2018

Copy link
Copy Markdown
Member

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

dunglas commented Feb 9, 2018 •

Copy link
Copy Markdown
Member Author

@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 sroze left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh, fair enough 👍

@sroze

sroze commented Feb 9, 2018

Copy link
Copy Markdown
Contributor

Thank you @dunglas.

@sroze
sroze merged commit 33ade8a into api-platform:master Feb 9, 2018
@sroze

sroze commented Feb 9, 2018

Copy link
Copy Markdown
Contributor

@dunglas
dunglas deleted the cors branch February 9, 2018 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants