2017 © Pedro Peláez
 

library laravel-cdnify

Add a CDN to any path when a specified environment is active.

image

metrique/laravel-cdnify

Add a CDN to any path when a specified environment is active.

  • Thursday, October 26, 2017
  • by ShinobiCorp
  • Repository
  • 2 Watchers
  • 6 Stars
  • 333 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 17 Versions
  • 7 % Grown

The README.md

laravel-cdnify

GitHub release, (*1)

Features

  • Add a CDN to any path when a specified environment is active in Laravel 5.
  • Easily publish laravel-mix or laravel-elixir versioned assets to a file system of your choice.

Installation

Set up.

  1. composer require metrique/laravel-cdnify
  2. Optionally add Metrique\CDNify\CDNifyServiceProvider::class to the list of Autoloaded Service Providers in config/app.php.
  3. Optionally add 'CDNify'=>Metrique\CDNify\CDNifyFacade::class to the list of Class Aliases in config/app.php.

CDNify supports Laravel Package Discovery and so steps 2 and 3 are optional., (*2)

Config.

Config defaults can be configured by editing config/cdnify.php in your main application directory., (*3)

You can publish the config/cdnify.php config file to your application config directory by running php artisan vendor:publish --tag="cdnify-config", (*4)

Usage

Examples.

Get Helper

A resource exists in your mix-manifest.json, which has been created by Laravel Mix. <script src="{{ $cdnify->get('js/site.js', true) }}" async></script>, (*5)

Get the CDN as a string.

$cdnify->cdn();, (*6)

Set a local path and get the full CDN path.

$cdnify->path('/some/static/resource.jpg')->toString();, (*7)

CDNify

$cdnify is automatically registered for use in all Laravel views., (*8)

$cdnify->defaults(); If environments, mix or roundRobin settings are changed, this will discard the changes in favour of the config settings., (*9)

$cdnify->cdn(); Returns a CDN path from the config, if roundRobin is set to true then it will iterate through the list of CDN's on each call., (*10)

$cdnify->path($path); Sets the path to be CDNified., (*11)

$cdnify->toString(); Returns the CDN and path as a string., (*12)

$cdnify->get($path, $params = []); Helper utility combining the path and toString methods. You may pass an array of params (mix, environments, roundRobin) to override the settings once., (*13)

$cdnify->environments($environments); Set the environments where the path should be CDNified., (*14)

$cdnify->mix($bool); Sets whether mix should be used, if available., (*15)

$cdnify->roundRobin($bool); Enables round robin iteration on the cdn list., (*16)

CDNify command

php artisan metrique:cdnify This command will run npm run production or gulp --production and then deploy any assets listed in mix-manifest.json to s3 (or other disk), via the Laravel Filesystem., (*17)

Options

--build-source[=BUILD-SOURCE] Sets the path to the source files that are to be uploaded. [default: "/build"], (*18)

--build-dest[=BUILD-DEST] Sets the path where files are to be uploaded. [default: "/build"]., (*19)

--disk[=DISK] Set disk/upload method. [default: "s3"], (*20)

--force Toggle force upload of files., (*21)

--skip-build Skips the running npm run production or gulp --production build process., (*22)

--manifest[=MANIFEST] Set manifest location. [default: "/build/mix-manifest.json"], (*23)

The Versions

26/10 2017

dev-master

9999999-dev

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

26/10 2017

1.2.3

1.2.3.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

08/09 2017

1.2.2

1.2.2.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

21/08 2017

1.2.1

1.2.1.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

30/06 2017

1.2.0

1.2.0.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

10/04 2017

1.1.2

1.1.2.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

27/03 2017

1.1.1

1.1.1.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

26/03 2017

1.0.7

1.0.7.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

26/03 2017

1.1.0

1.1.0.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

23/12 2016

0.1

0.1.0.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

10/10 2016

1.0.6

1.0.6.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/09 2016

1.0.5

1.0.5.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

06/09 2016

1.0.4

1.0.4.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

22/08 2016

1.0.3

1.0.3.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

31/07 2016

1.0.2

1.0.2.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

05/07 2016

1.0.1

1.0.1.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires

29/06 2016

v1.0.0

1.0.0.0

Add a CDN to any path when a specified environment is active.

  Sources   Download

MIT

The Requires

 

The Development Requires