PHP code example of white43 / yii2-cloud-asset-manager
1. Go to this page and download the library: Download white43/yii2-cloud-asset-manager 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/ */
white43 / yii2-cloud-asset-manager example snippets
$config = [
'components' => [
'assetManager' => [
'class' => \white43\CloudAssetManager\CloudAssetManager::class,
'basePath' => 'local/path/to/assets',
'baseUrl' => '//your.cdn.com/remote/path/to/assets',
'cache' => 'cache', // Name of your cache component
'verbose' => true, // To dump copying process to stdout
'adapter' => function (): \League\Flysystem\FilesystemAdapter {
$s3 = new \Aws\S3\S3Client([
'credentials' => [
'key' => 'Access Key ID',
'secret' => 'Secret Access Key',
],
'region' => 'eu-central-1',
'version' => 'latest',
// The following options are useful when you need to connect to a S3-compatible storage
// 'endpoint' => '',
// 'use_path_style_endpoint' => true,
]);
return new \League\Flysystem\AwsS3V3\AwsS3V3Adapter($s3, 'Your bucket name');
},
],
],
];