PHP code example of diegohq / cdn

1. Go to this page and download the library: Download diegohq/cdn 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/ */

    

diegohq / cdn example snippets


'providers' => array(
     //...
     Vinelab\Cdn\CdnServiceProvider::class,
),

'default' => 'AwsS3',

'aws' => [

    's3' => [
    
        'version'   => 'latest',
        'region'    => '',


        '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
],

'url' => 'https://s3.amazonaws.com',

'http' => '['verify' => path-to-your-pem-certificate-file]',

'bypass' => true,

'cloudfront'    => [
    'use' => false,
    'cdn_url' => ''
],

'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 vinelab/cdn
bash
php artisan cdn:push
bash
php artisan cdn:empty