Subscribe to PHP Freaks RSS

Cloudways Blog: Integrate CloudwaysCDN With Laravel Applications

syndicated from www.phpdeveloper.org on October 30, 2017

The Cloudways blog has a post showing you how to integrate their content delivery network (CDN) with Laravel applications to take some load off of your servers by serving up static content from a fast, remote location.

With the recent release of Laravel 5.5 and Laravel Horizon, the Laravel ecosystem has reached a whole new level of maturity. In effect, Laravel has become a great option for PHP projects. the whole new level.

[...] Cloudways has recently launched a Content Delivery System (CDN) to help the users provide a better UX their Laravel projects. In this article, I will demonstrate the process of implementing Laravel CDN.

With Cloudways account in hand they start by showing how to map a domain and enable the SSL certificate functionality (a requirement). Next they show how to enable the CDN functionality for your domain and get the source URL to use in your application. Next the tutorial moves over to the Laravel side including a custom handler that checks for a CDN configuration. If present, the asset() call returns that URL rather than a local one.