Skip to content

maarten-mald-digital/cdn-helper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%