Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 18, 2024 via composer

nelmio/cors-bundle 2.4.0

Adds CORS (Cross-Origin Resource Sharing) headers support in your Symfony application
Package summary
Share
0
issues
1
license
27
MIT
Package created
8 Dec 2011
Version published
30 Nov 2023
Maintainers
1
Total deps
27
Direct deps
2
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
27 Packages, Including:
nelmio/cors-bundle@2.4.0
psr/cache@3.0.0
psr/container@2.0.2
psr/event-dispatcher@1.0.0
psr/log@3.0.0
symfony/cache@v7.0.7
symfony/cache-contracts@v3.5.0
symfony/config@v7.0.7
symfony/dependency-injection@v7.0.7
symfony/deprecation-contracts@v3.5.0
symfony/error-handler@v7.0.7
symfony/event-dispatcher@v7.0.7
symfony/event-dispatcher-contracts@v3.5.0
symfony/filesystem@v7.0.7
symfony/finder@v7.0.7
symfony/framework-bundle@v7.0.7
symfony/http-foundation@v7.0.7
symfony/http-kernel@v7.0.7
symfony/polyfill-ctype@v1.29.0
symfony/polyfill-mbstring@v1.29.0
symfony/polyfill-php80@v1.29.0
symfony/polyfill-php83@v1.29.0
symfony/process@v7.0.7
symfony/routing@v7.0.7
symfony/service-contracts@v3.5.0
symfony/var-dumper@v7.0.7
symfony/var-exporter@v7.0.7
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of nelmio/cors-bundle 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
psr/log3.0.06.77 kBMIT
prod dev
symfony/framework-bundlev7.0.7-MIT
prod

Visualizations

Frequently Asked Questions

What does nelmio/cors-bundle do?

The NelmioCorsBundle package essentially enables Cross-Origin Resource Sharing (CORS) headers support in your Symfony PHP application. This is key for allowing secure cross-domain data transfers, with an emphasis on building API-based infrastructure that's compatible with AJAX calls in web applications.

How do you use nelmio/cors-bundle?

You can integrate and use the nelmio/cors-bundle in your Symfony application in the following way:

Firstly, install the package via Composer. If you're using Symfony Flex, you can run:

composer req cors

For non-Symfony Flex use, require the nelmio/cors-bundle in your composer.json and update your dependencies:

$ composer require nelmio/cors-bundle

Then, add the NelmioCorsBundle to your application's kernel:

public function registerBundles()
{
    $bundles = [
        // ...
        new Nelmio\CorsBundle\NelmioCorsBundle(),
        // ...
    ];
    // ...
}

Next, Symfony Flex generates a default configuration in config/packages/nelmio_cors.yaml. You can customize the CORS settings for paths and allowed headers and methods. An example configuration:

nelmio_cors:
    defaults:
        allow_origin: ['*']
        allow_headers: ['X-Custom-Auth']
        allow_methods: ['POST', 'PUT', 'GET', 'DELETE']
        max_age: 3600
    paths:
        '^/api/':
            allow_origin: ['*']
            allow_headers: ['X-Custom-Auth']
            allow_methods: ['POST', 'PUT', 'GET', 'DELETE']
            max_age: 3600

Here, CORS requests from any origin are allowed on /api/, with some methods defined as allowed. Preflight requests can be cached for 3600 seconds.

Where are the nelmio/cors-bundle docs?

The documentation for the nelmio/cors-bundle lives in the README file on the GitHub repository (https://github.com/nelmio/NelmioCorsBundle), where you can find information about the package's features, installation instructions, configuration guidance, and a cookbook section on how to handle specific use cases.