PHP code example of duxthefux / laravelcdn
1. Go to this page and download the library: Download duxthefux/laravelcdn library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
duxthefux / laravelcdn example snippets
'providers' => array(
//...
Publiux\laravelcdn\CdnServiceProvider::class,
),
'aliases' => array(
//...
'CDN' => Publiux\laravelcdn\Facades\CdnFacadeAccessor::class
),
'url' => env('CDN_Url', 'https://s3.amazonaws.com'),
'bypass' => env('CDN_Bypass', false),
'cloudfront' => [
'use' => env('CDN_UseCloudFront', false),
'cdn_url' => env('CDN_CloudFrontUrl', false)
],
'default' => 'AwsS3',
'aws' => [
's3' => [
'version' => 'latest',
'region' => '',
'endpoint' => '', // For DO Spaces
'buckets' => [
'my-backup-bucket' => '*',
]
]
],
'buckets' => [
'my-default-bucket' => '*',
// 'js-bucket' => ['public/js'],
// 'css-bucket' => ['public/css'],
// ...
]
' 'directories' => ['public/dist'],
'extensions' => ['.js', '.css', '.yxz'],
'patterns' => ['**/*.coffee'],
],
'exclude' => [
'directories' => ['public/uploads'],
'files' => [''],
'extensions' => ['.TODO', '.txt'],
'patterns' => ['src/*', '.idea/*'],
'hidden' => true, // ignore hidden files
],
'acl' => 'public-read',
'metadata' => [ ],
'expires' => gmdate("D, d M Y H:i:s T", strtotime("+5 years")),
'cache-control' => 'max-age=2628000',
bash
php artisan vendor:publish --provider 'Publiux\laravelcdn\CdnServiceProvider'
bash
php artisan cdn:push
bash
php artisan cdn:empty