Symfony CDN Plugin
A symfony plugin to rewrite asset URIs to be served via a content delivery network.
This plugin is for symfony version 1.4 or above (however should also work with version 1.0 and above, although untested).
Download
| bedicanCdnPlugin 1.0 | bedicanCdnPlugin-1.0.zip | Download |
Configuration
The following configuration should be added to the applications app.yml configuration file. See the sample app.yml within the plugin for more.
all:
cdn:
# Whether to also minify html and strip html comments.
minify: true
# The content delivery network hostnames.
# Asset URIs will be re-written to use these hostnames.
hosts:
images: i.mycdn.com
javascripts: j.mycdn.com
stylesheets: c.mycdn.com
# If the asset URI matches an exclusion it will not be re-written.
# Wildcards may be used:
# * matching any character not including forward slash.
# ** matching any character including forward slash.
exclusions:
images:
- /path/to/image.jpg
- /path/to/directory/*
javascripts:
- /path/to/javascript.js
- /path/to/directory/*
stylesheets:
- /path/to/stylesheet.css
- /path/to/directory/*
- /all/css/under/directory/**.css
Installing
Unpack the plugin to the plugins directory, enable it and configure the CdnFilter within the applications filters.yml configuration file.
cdnfilter: class: CdnFilter
License
© Copyright 2010, 2012 Bedican Solutions
Redistribution and use of this software is permitted providing the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name bedican, bedican solutions nor the name of the author, may be used to endorse or promote any website or products without specific prior written permission. The name bedican is a trademark of bedican solutions.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
