PHPackages                             bryanjhv/laravel-blade-cdn - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. bryanjhv/laravel-blade-cdn

ActiveLibrary[Templating &amp; Views](/categories/templating)

bryanjhv/laravel-blade-cdn
==========================

Blade directive to get asset URLs according to environment.

1.0.2(9y ago)21781MITPHP

Since Aug 14Pushed 9y ago2 watchersCompare

[ Source](https://github.com/bryanjhv/laravel-blade-cdn)[ Packagist](https://packagist.org/packages/bryanjhv/laravel-blade-cdn)[ Docs](https://github.com/bryanjhv/laravel-blade-cdn)[ RSS](/packages/bryanjhv-laravel-blade-cdn/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Laravel Blade CDN
=================

[](#laravel-blade-cdn)

A [Blade](https://laravel.com/docs/blade) directive for getting asset URLs according to app environment.

Installation
------------

[](#installation)

Require this package with [Composer](https://getcomposer.org) using the following command

```
composer require bryanjhv/laravel-blade-cdn
```

After updating Composer, add the service provider to the `providers` array in your `config/app.php` file:

```
Bryanjhv\BladeCdn\BladeCdnServiceProvider::class,
```

Finally, publish the config file, so you can configure your own CDN aliases and prefix:

```
php artisan vendor:publish --provider="Bryanjhv\BladeCdn\BladeCdnServiceProvider" --tag=config
```

Usage
-----

[](#usage)

**Important**: First at all, please remove all your cached views, using:

```
php artisan view:clear
```

The service provider makes the `@cdn` Blade directive available, so you can use it like so (working on `resources/views/sample.blade.php`):

```

```

The above code will be expanded, in production, using the default configuration file the package ships with, to:

```
