CDN helper
- First install the helper with composer:
composer require mald/cdn-helper
- Publish assets:
php artisan vendor:publish --tag=mald-cdn-helper
Add CDN_URL to the .env of the project with the correct url towards the cdn, for example:
CDN_URL=https://d1pj9b3xsimjd0.cloudfront.net
Within our project you can use the cdn() helper function which accepts 3 parameters:
<?php
if (!function_exists('cdn')) {
function cdn(string $path, ?string $dimensions = null, ?string $mode = 'crop'): string
{
return new \CdnHelper\Url($path, $dimensions, $mode);
}
}
Run the tests with;
./vendor/bin/phpunit