How to implement cdn in laravel?

Page 1

How to Implement CDN in Laravel?

Implementing CDN into Laravel is no more easier for a nontechnical person. It needs a lot of efforts to implement a Content Delivery Network into Laravel! We would let you understand the entire process of implementing CDN into Laravel with the help of CDN Assets Manager Package. Have a look into this and move on reading to find various ways for the same. https://github.com/Vinelab/cdn Install it Via Composer: { “require”: { “vinelab/cdn”: “*” } Add your CDN Credentials: ‘credentials’ => [ ‘key’ => ”, ‘secret’ => ”, ], ‘buckets’ => [ ‘bucket-name-here’ => ‘*’, ] Specify directories, extensions, files and patterns to be uploaded ‘include’ => [ ‘directories’ => [‘public/dist’], ‘extensions’ => [‘.js’, ‘.css’, ‘.yxz’], ‘patterns’ => [‘**/*.coffee’], ], Also specify what to be ignored ‘exclude’ => [ ‘directories’ => [‘public/uploads’], ‘files’ => [”], ‘extensions’ => [‘.TODO’, ‘.txt’], ‘patterns’ => [‘src/*’, ‘.idea/*’], ‘hidden’ => true, // ignore hidden files ], USAGE: Run this artisan command to push your assets to the CDN.


Run this artisan command to push your assets to the CDN.

php artisan cdn:push

Use it as follow in your Views or anywhere else in your code:

{{ Cdn::asset(‘public/assets/js/script.js’) }}

{{ Cdn::asset(‘public/assets/css/main.css’) }}

You can create a helper as described here: https://www.keycdn.com/support/laravel-cdn-integration This approach is fairly easy and you don’t need to upload anything if you’re using a pull zone.

*Contact Us* Address : 3405 Pennsylvania Common, Fremont, CA 94536 USA Email

: sales.usa@elsner.com

Phone

: +1 (607) 524-4040

Website : http://www.elsner.com


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.