mald / cdn-helper
Helper function to create CDN url's
dev-master
2023-03-23 11:18 UTC
Requires
- php: ^7.1|^8.0|^8.1
- ext-json: *
- laravel/framework: ^5.8|^6.0|^7.0|^8.0|^9.0|^10.0
Requires (Dev)
- orchestra/testbench: ^3.5
This package is auto-updated.
Last update: 2024-04-23 14:00:19 UTC
README
CDN helper
Installation
- 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
Usage
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); } }
Testing
Run the tests with;
./vendor/bin/phpunit