PHPackages                             bionicmaster/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. [File &amp; Storage](/categories/file-storage)
4. /
5. bionicmaster/cdn

ActiveLibrary[File &amp; Storage](/categories/file-storage)

bionicmaster/cdn
================

Content Delivery Network (CDN) Package for Laravel

v1.4.5(9y ago)073MITPHPPHP &gt;=5.5.0

Since Sep 8Pushed 8y ago1 watchersCompare

[ Source](https://github.com/bionicmaster/cdn)[ Packagist](https://packagist.org/packages/bionicmaster/cdn)[ RSS](/packages/bionicmaster-cdn/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (24)Used By (0)

Laravel CDN Assets Manager
==========================

[](#laravel-cdn-assets-manager)

[![Total Downloads](https://camo.githubusercontent.com/fa355dd07c688a3e0778ffcaee1a61c6982847e2636c541a37b807fdad65b081/68747470733a2f2f706f7365722e707567782e6f72672f76696e656c61622f63646e2f646f776e6c6f616473)](https://packagist.org/packages/vinelab/cdn)[![Latest Stable Version](https://camo.githubusercontent.com/c4d738210059b7b04563b849cb3c9773bb0eb42358d9bdae7952cde8c3101fc2/68747470733a2f2f706f7365722e707567782e6f72672f76696e656c61622f63646e2f762f737461626c65)](https://packagist.org/packages/vinelab/cdn)[![Latest Unstable Version](https://camo.githubusercontent.com/9fad983ec5413222b88403b06ef9b665cc67dc4b201944cd68e6891f9539e2c5/68747470733a2f2f706f7365722e707567782e6f72672f76696e656c61622f63646e2f762f756e737461626c65)](https://packagist.org/packages/vinelab/cdn)[![Build Status](https://camo.githubusercontent.com/a2be17abef446fdf5c09140d815bffd15b41d3e8aca68d241263ffc075d3498a/68747470733a2f2f7472617669732d63692e6f72672f56696e656c61622f63646e2e737667)](https://travis-ci.org/Vinelab/cdn)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/dc18dbd0f67eb52cb6ea03f4fc0d4d2a5282c9613a0d01afe4fd00971ff3da26/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f56696e656c61622f63646e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Vinelab/cdn/?branch=master)[![License](https://camo.githubusercontent.com/36fde7889dc3fb25ac0b1f51f0665ab41ba34032c806b8ac723790c5a6bdd8b2/68747470733a2f2f706f7365722e707567782e6f72672f76696e656c61622f63646e2f6c6963656e7365)](https://packagist.org/packages/vinelab/cdn)

##### Content Delivery Network Package for Laravel

[](#content-delivery-network-package-for-laravel)

The package provides the developer the ability to upload his assets (or any public file) to a CDN with a single artisan command. And then it allows him to switch between the local and the online version of the files.

#### Laravel Support

[](#laravel-support)

- For Laravel 5.1 use the latest realease (`master`).
- For Laravel 4.2 use the realease `v1.0.1` [Last suport for L 4.2](https://github.com/Vinelab/cdn/releases/tag/v1.0.1)

Highlights
----------

[](#highlights)

- Amazon Web Services - S3
- Artisan command to upload content to CDN
- Simple Facade to access CDN assets

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

[](#installation)

#### Via Composer

[](#via-composer)

Require `vinelab/cdn` in your project:

```
composer require vinelab/cdn:*
```

*Since this is a Laravel package we need to register the service provider:*

Add the service provider to `config/app.php`:

```
'providers' => array(
     //...
     Vinelab\Cdn\CdnServiceProvider::class,
),
```

Configuration
-------------

[](#configuration)

Set the Credentials in the `.env` file.

*Note: you must have an `.env` file at the project root, to hold your sensitive information.*

```
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
```

Publish the package config file:

```
php artisan vendor:publish vinelab/cdn
```

You can find it at `config/cdn.php`

##### Default Provider

[](#default-provider)

```
'default' => 'AwsS3',
```

##### CDN Provider Configuration

[](#cdn-provider-configuration)

```
'aws' => [

    's3' => [

        'version'   => 'latest',
        'region'    => '',

        'buckets' => [
            'my-backup-bucket' => '*',
        ]
    ]
],
```

###### Multiple Buckets

[](#multiple-buckets)

```
'buckets' => [

    'my-default-bucket' => '*',

    // 'js-bucket' => ['public/js'],
    // 'css-bucket' => ['public/css'],
    // ...
]
```

#### Files &amp; Directories

[](#files--directories)

###### Include:

[](#include)

Specify directories, extensions, files and patterns to be uploaded.

```
'include'    => [
    'directories'   => ['public/dist'],
    'extensions'    => ['.js', '.css', '.yxz'],
    'patterns'      => ['**/*.coffee'],
],
```

###### Exclude:

[](#exclude)

Specify what to be ignored.

```
'exclude'    => [
    'directories'   => ['public/uploads'],
    'files'         => [''],
    'extensions'    => ['.TODO', '.txt'],
    'patterns'      => ['src/*', '.idea/*'],
    'hidden'        => true, // ignore hidden files
],
```

##### URL

[](#url)

Set the CDN URL:

```
'url' => 'https://s3.amazonaws.com',
```

##### HTTP

[](#http)

Set the HTTP parameters:

```
'http' => '['verify' => path-to-your-pem-certificate-file]',
```

##### Bypass

[](#bypass)

To load your LOCAL assets for testing or during development, set the `bypass` option to `true`:

```
'bypass' => true,
```

##### Cloudfront Support

[](#cloudfront-support)

```
'cloudfront'    => [
    'use' => false,
    'cdn_url' => ''
],
```

##### Other Configurations

[](#other-configurations)

```
'acl'           => 'public-read',
'metadata'      => [ ],
'expires'       => gmdate("D, d M Y H:i:s T", strtotime("+5 years")),
'cache-control' => 'max-age=2628000',
```

You can always refer to the AWS S3 Documentation for more details: [aws-sdk-php](http://docs.aws.amazon.com/aws-sdk-php/v3/guide/)

Usage
-----

[](#usage)

#### Push

[](#push)

Upload assets to CDN

```
php artisan cdn:push
```

#### Empty

[](#empty)

Delete assets from CDN

```
php artisan cdn:empty
```

#### Load Assets

[](#load-assets)

Use the facade `Cdn` to call the `Cdn::asset()` function.

*Note: the `asset` works the same as the Laravel `asset` it start looking for assets in the `public/` directory:*

```
{{Cdn::asset('assets/js/main.js')}}        // example result: https://js-bucket.s3.amazonaws.com/public/assets/js/main.js

{{Cdn::asset('assets/css/style.css')}}        // example result: https://css-bucket.s3.amazonaws.com/public/assets/css/style.css
```

*Note: the `elixir` works the same as the Laravel `elixir` it loads the manifest.json file from build folder and choose the correct file revision generated by gulp:*

```
{{Cdn::elixir('assets/js/main.js')}}        // example result: https://js-bucket.s3.amazonaws.com/public/build/assets/js/main-85cafe36ff.js

{{Cdn::elixir('assets/css/style.css')}}        // example result: https://css-bucket.s3.amazonaws.com/public/build/assets/css/style-2d558139f2.css
```

To use a file from outside the `public/` directory, anywhere in `app/` use the `Cdn::path()` function:

```
{{Cdn::path('private/something/file.txt')}}        // example result: https://css-bucket.s3.amazonaws.com/private/something/file.txt
```

Test
----

[](#test)

To run the tests, run the following command from the project folder.

```
$ ./vendor/bin/phpunit
```

Support
-------

[](#support)

[On Github](https://github.com/Vinelab/cdn/issues)

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/Vinelab/cdn/blob/master/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Mahmoud Zalt](https://github.com/Mahmoudz)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/Vinelab/cdn/blob/master/LICENSE) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~41 days

Recently: every ~62 days

Total

22

Last Release

3386d ago

PHP version history (2 changes)v1.0.0-beta.1PHP &gt;=5.4.0

v1.1.6PHP &gt;=5.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b3cd4a747548ff36eac9cbaa2bcc86bc2c703e8feb820cc552d7189fc3f82c46?d=identicon)[bionicmaster](/maintainers/bionicmaster)

---

Top Contributors

[![Mulkave](https://avatars.githubusercontent.com/u/2647333?v=4)](https://github.com/Mulkave "Mulkave (42 commits)")[![Mahmoudz](https://avatars.githubusercontent.com/u/1983984?v=4)](https://github.com/Mahmoudz "Mahmoudz (25 commits)")[![olimorris](https://avatars.githubusercontent.com/u/9512444?v=4)](https://github.com/olimorris "olimorris (17 commits)")[![RajeshHegde](https://avatars.githubusercontent.com/u/2469301?v=4)](https://github.com/RajeshHegde "RajeshHegde (11 commits)")[![bionicmaster](https://avatars.githubusercontent.com/u/312215?v=4)](https://github.com/bionicmaster "bionicmaster (5 commits)")[![mmubasharsheikh](https://avatars.githubusercontent.com/u/11888803?v=4)](https://github.com/mmubasharsheikh "mmubasharsheikh (2 commits)")[![filipegar](https://avatars.githubusercontent.com/u/9282579?v=4)](https://github.com/filipegar "filipegar (2 commits)")[![juniorb2ss](https://avatars.githubusercontent.com/u/3980385?v=4)](https://github.com/juniorb2ss "juniorb2ss (1 commits)")[![itainathaniel](https://avatars.githubusercontent.com/u/971236?v=4)](https://github.com/itainathaniel "itainathaniel (1 commits)")[![byhbt](https://avatars.githubusercontent.com/u/948856?v=4)](https://github.com/byhbt "byhbt (1 commits)")

---

Tags

laravelamazons3awsuploadcdnaws-s3content delivery networkAssets Upload

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bionicmaster-cdn/health.svg)

```
[![Health](https://phpackages.com/badges/bionicmaster-cdn/health.svg)](https://phpackages.com/packages/bionicmaster-cdn)
```

###  Alternatives

[vinelab/cdn

Content Delivery Network (CDN) Package for Laravel

217240.8k1](/packages/vinelab-cdn)[publiux/laravelcdn

Content Delivery Network (CDN) Package for Laravel

155230.4k](/packages/publiux-laravelcdn)[aws/aws-sdk-php-laravel

A simple Laravel 9/10/11/12/13 service provider for including the AWS SDK for PHP.

1.7k35.6M74](/packages/aws-aws-sdk-php-laravel)[juhasev/laravelcdn

Content Delivery Network (CDN) Package for Laravel

1820.4k](/packages/juhasev-laravelcdn)[unisharp/s3-presigned

An AWS S3 package for pre-signed upload purpose in Laravel and PHP.

141.8k](/packages/unisharp-s3-presigned)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
