PHPackages                             webravolab/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. webravolab/cdn

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

webravolab/cdn
==============

Webravo custom CDN assets manager

0.2.9(7y ago)06331MITPHPPHP ^7.0

Since Jul 6Pushed 7y ago1 watchersCompare

[ Source](https://github.com/webravolab/cdn)[ Packagist](https://packagist.org/packages/webravolab/cdn)[ RSS](/packages/webravolab-cdn/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (30)Used By (1)

CDN Images and Assets Manager for Laravel
=========================================

[](#cdn-images-and-assets-manager-for-laravel)

##### Content Delivery Network Package for Laravel

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

The package handle automatic image processing and upload to a remote CDN.

Two remote CDN providers are included, a custom one and the Google Storage Bucket driver, but you can implement your own driver to interface with any standard CDN like AWS, Cloudflare ...

#### Laravel Support

[](#laravel-support)

- Tested with Laravel 5.2
- Not tested with higher Laravel versions

Usage
-----

[](#usage)

Use the Cdn facade to interact, for example from your blade template:

```

```

*simplest example without any option*

```

```

*complex image transform and custom name*

### Image processing options:

[](#image-processing-options)

The full sintax is:

```
Cdn::image($source_file, array $options)
```

Source file must be a file name path relative to public directory.

Options are a combination of the following:

- name: the path and name where the image must be uploaded to the Cdn
- mode: image processing, one of the following
    - resize
    - forceresize
    - zoom
    - zoomcrop
    - crop
    - cropresize
    - scale
    - resizecanvas
    - cropauto
- type: image output type, one of "png","jpg","jpeg","gif", could be different from source image type causing type conversion.
- size: the desidered size of resulting image, formatted as \[nnn\]x\[nnn\] (Es. 100x150)
- position: for processing requiring a start position (crop etc.) the start position formatted as \[nnn\]-\[nnn\] or \[nnn\]x\[nnn\]
- background: one of "white", "black" or "transparent", or a #rrggbb color code to set as image background
- quality: a value 0-100 for images handling compression (png / jpg)
- overwrite: true/false to bypass config parameter
- checksize: true/false to bypass config parameter

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

[](#installation)

#### Via Composer

[](#via-composer)

Require `webravolab/cdn` in your project:

```
composer require webravolab/cdn
```

To use the Google Storage driver you must also install the Google Api Client and Webravolab Layers:

```
composer require google/apiclient:^2.2
composer require webravolab/layers:^1.0
```

You must register manually the service provider:

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

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

Publish the default configuration file:

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

To use the Google Storage driver you must add the following configuration variables to your environment:

```
GOOGLE_APPLICATION_NAME=""
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
GOOGLE_DEVELOPER_KEY=""
GOOGLE_REDIRECT="urn:ietf:wg:oauth:2.0:oob"
GOOGLE_SERVICE_ENABLED=true
GOOGLE_APPLICATION_CREDENTIALS=""
GOOGLE_STORAGE_DEFAULT_BUCKET=""
GOOGLE_STORAGE_IMAGE_CACHE_TTL=86400

```

Dependencies
------------

[](#dependencies)

This package depends on the wonderful [gregwar/image](https://github.com/Gregwar/Image) to process images and [guzzlehttp/guzzle](https://github.com/guzzlehttp/guzzle)to manage assets upload to cdn.

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

[](#configuration)

Configuration is copied at `config/webravo_cdn.php`

##### Default Provider

[](#default-provider)

```
'default' => 'Webravo',
```

or

```
'default' => 'GoogleStorage',
```

##### CDN Provider Configuration

[](#cdn-provider-configuration)

For Webravo provider, you must define just your cdn url and specific url to upload assets. For Google Storage provider you must define the remote bucket name, the default TTL, and the storage URL to pre-pend to assets.

Optionally, you can define another bucket (cdn\_bucket) to use when creating assets url, in case you handle separate buckets for upload and retrieve. If omitted, the same bucket name is used.

```
'providers' => [
    'Webravo' => [
        'url' => 'https://www.my-cdn.com',
        'upload_url' => 'https://www.my-cdn.com/cdn/upload',
    ],
    'GoogleStorage' => [
        'bucket' => '',
        'ttl' => '86400'
        'url' => 'https://storage.googleapis.com',
        'cdn_bucket' => '',
    ]],
```

##### Bypass

[](#bypass)

To disable CDN and load your assets from local machine for testing purposes, set the `bypass` option to `true`:

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

##### Don't overwrite CDN images if source is missing

[](#dont-overwrite-cdn-images-if-source-is-missing)

As per default, missing images are replaced by a fallback image (overwrite = true by default). To change this behaviour set overwrite to false in your configuration file.

```
'overwrite' => false,
```

Overwrite flag could be passed also as optional parameter to any Cdn:: call.

##### Check for file size changes

[](#check-for-file-size-changes)

As per default, file size is not checked to detect image changes, but only modification date is used. To enable file size check set checksize to true in your configuration file.

```
'checksize' => true,
```

Checksize flag could be passed also as optional parameter to any Cdn:: call.

### Elixir assets

[](#elixir-assets)

*(Webravo provider only)*

```
{{Cdn::elixir('assets/js/main.js')}}        // example result: https://www.my-cdn.com/build/assets/js/main-85cafe36ff.js

{{Cdn::elixir('assets/css/style.css')}}        // example result: https://www.my-cdn.com/build/assets/css/style-2d558139f2.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:*

*Note: currently, the `elixir` command does not copy assets to Cdn, but simply add/replace the url with the Cdn url*

Test
----

[](#test)

No test available.

Support
-------

[](#support)

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

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

[](#contributing)

- This is a heavy customized package for Webravo internal use. You should fork it and try to customize to fit your needs.

Credits
-------

[](#credits)

- Heavily inspired by [Vinelab/cdn](https://github.com/Vinelab/cdn) package for general code organization and facade interface.

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.9% of commits — single point of failure

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 ~10 days

Recently: every ~3 days

Total

29

Last Release

2572d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/98fa0d207fa087e4170f308b1e2d6735572813fc2c5972f55c8e96c6155e3a7a?d=identicon)[paolo.nardini.bravosconto](/maintainers/paolo.nardini.bravosconto)

---

Top Contributors

[![PaoloNardini](https://avatars.githubusercontent.com/u/10460883?v=4)](https://github.com/PaoloNardini "PaoloNardini (31 commits)")[![webravolab](https://avatars.githubusercontent.com/u/40839676?v=4)](https://github.com/webravolab "webravolab (1 commits)")

### Embed Badge

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

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k511.3M2.2k](/packages/aws-aws-sdk-php)[google/cloud

Google Cloud Client Library

1.2k16.2M53](/packages/google-cloud)[stechstudio/laravel-zipstream

A fast and simple streaming zip file downloader for Laravel.

4633.7M3](/packages/stechstudio-laravel-zipstream)[fof/upload

The file upload extension for the Flarum forum with insane intelligence.

188171.7k15](/packages/fof-upload)[uploadcare/uploadcare-php

Uploadcare PHP integration handles uploads and further operations with files by wrapping Upload and REST APIs.

1022.5M6](/packages/uploadcare-uploadcare-php)[azure-oss/storage

Azure Blob Storage PHP SDK

37985.0k5](/packages/azure-oss-storage)

PHPackages © 2026

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