CakePHP helper to link to assets from a dedicated asset server
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

CAKEPHP CDN/Clould Front helper

Inspired by: Amazon's Cloud Front

And RoR's asset host helper: RoR's api docs :{

(Please read the above link for a detailed explanation of what's going on here)

Instead of using Javascript or HTML helpers, you can use the provided Cf (Cloud Front) helper to create links to assets, you can now use:

  • $cf->image();
  • $cf->jsLink();
  • $cf->css();

All options are exactly the same as default CakePHP helpers.

We make an assumption that local file system mirrors the remote one (on S3/Cloud Front/etc.)

The only settings you need to be concerned about are:

  • $assetHost = '';
  • $numHostsMin = 0;
  • $numHostsMax = 3;
  • $sslHost = '';

** Be sure to replace the above values in the helper to match your setup **

For any questions please contact me at the relevant blog post: Over here

Your input is greatly appreciated.