Skip to content

Latest commit

 

History

History
executable file
·
40 lines (26 loc) · 798 Bytes

readme.md

File metadata and controls

executable file
·
40 lines (26 loc) · 798 Bytes

mald/cdn-helper

CDN helper

Installation

  1. First install the helper with composer:

composer require mald/cdn-helper

  1. 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