https://github.com/caxy/xdomainbundle
https://github.com/caxy/xdomainbundle
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/caxy/xdomainbundle
- Owner: caxy
- Created: 2015-02-27T17:09:54.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-07-12T01:48:08.000Z (almost 10 years ago)
- Last Synced: 2025-06-20T04:13:01.400Z (about 1 year ago)
- Language: PHP
- Size: 13.7 KB
- Stars: 0
- Watchers: 33
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
XDomain Bundle
==============
Use this bundle to support cross-domain XHR without [CORS](https://caniuse.com/cors). It
depends on the [XDomain](https://github.com/jpillora/xdomain) JavaScript library.
Installation
------------
Require the `caxy/xdomain-bundle` package in your composer.json and update
your dependencies.
$ composer require caxy/xdomain-bundle
Register the bundle in `app/AppKernel.php`:
```php
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Caxy\Bundle\XDomainBundle\CaxyXDomainBundle(),
);
}
```
Import the routing definition in `routing.yml`:
```yaml
# app/config/routing.yml
caxy_xdomain:
resource: "@CaxyXDomainBundle/Resources/config/routing.yml"
```
Enable the bundle's configuration in `app/config/config.yml`:
```yaml
# app/config/config.yml
caxy_xdomain:
allow_from: http://example.com
```
Add an asset named `xdomain_js` to your Assetic bundle configuration with the URL of
the XDomain script. The URL in this example comes from the [XDomain
documentation](https://github.com/jpillora/xdomain#download).
```yaml
# app/config/config.yml
framework:
assets:
packages:
xdomain:
version: 0.7.5
version_format: %%2$s/dist/%%1$s
base_urls:
- //cdn.rawgit.com/jpillora/xdomain
```