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

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

samuell/cdn-plugin
==================

Push, sync, clear and serve assets to/from a CDN or include manifest files from webpack or laravel-mix.

1.0.2(5y ago)63234MITPHPPHP &gt;=7.3

Since Apr 16Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Samuell1/cdn-plugin)[ Packagist](https://packagist.org/packages/samuell/cdn-plugin)[ Docs](https://github.com/Samuell1/cdn-plugin)[ RSS](/packages/samuell-cdn-plugin/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

OctoberCMS CDN Plugin
=====================

[](#octobercms-cdn-plugin)

Push, sync, clear and serve assets to/from a CDN or use it for including manifest files from webpack or laravel-mix.

Usage
-----

[](#usage)

In your theme change asset links to use *asset\_cdn* function.

*Example:*

```

```

**Note:** If you doesn't want to use CDN you can disable cdn in config and it will automatically fallback to theme path and use files from theme. (This is default configuration)

**With manifest integration enabled:**

We define file name that is compiled from Webpack or LaravelMix and exists in `manifest.json` file. Don't forget to enabled manifest integration and define correct `manifest.json` path in config file.

```

```

Getting assets from cdn that are not in `manifest.json` file use `cdn` function with full path to file:

```

```

**After configuration (configuration steps are below) we can sync theme assets to cdn**

Depending on theme run command to sync specific theme. For example to sync theme with name **demo** we use `php artisan cdn:sync demo`. If you want to remove old files that are compared with your local copy you can use flag `--delete-old`

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

[](#configuration)

##### 1. Configure Filesystem

[](#1-configure-filesystem)

If is your plan to use CDN, you can use this config. If not you can skip this step. *Example is for AWS S3 with Cloudfront.*

**config/filesystems.php**

```
'asset-cdn' => [
    'driver' => 's3',
    'key'    => env('S3_KEY'),
    'secret' => env('S3_SECRET'),
    'region' => env('S3_REGION'),
    'bucket' => env('S3_BUCKET'),
    'root'   => 'assets/',
],
```

##### 2. Configure config

[](#2-configure-config)

Create `cdn.php` file in **config** folder to configure cdn plugin, this allows to use different configs for developing or local enviroments.

*Don't forget to define `root` filesystem folder same as `assetsFolder` best is to use default as `assets` to match october default theme assets folder.*

**config/cdn.php**

```
return [

  // CDN integration
  'active' => false,
  'url' => 'https://cdn.mydomain.com/',
  'assetsFolder' => '/assets/',

  // Manifest integration (webpack, laravel mix)
  'useManifest' => false,
  'manifestPath' => '/assets/compiled/manifest.json',

  // Filesystem information that will be used with sync, push, clear commands
  'filesystem' => [
    'disk' => 'asset-cdn',
    'options' => []
  ]

  // Files filter
  'files' => [
    'ignoreDotFiles' => true,
    'ignoreVCS' => true,
    'include' => [
        'paths' => [
            //
        ],
        'files' => [
            //
        ],
        'extensions' => [
            //
        ],
        'patterns' => [
            //
        ],
    ],
    'exclude' => [
      'paths' => [
        //
      ],
      'files' => [
          //
      ],
      'extensions' => [
          //
      ],
      'patterns' => [
          //
      ],
    ],
  ],
];
```

**Optional filesystem options:**

Filesystem allows to define custom options. *The following example is recommended for AWS S3.*

**cdn.php &gt; filesystem.options**

```
    'options' => [
       'ACL' => 'public-read',
       'CacheControl' => 'max-age=31536000, public'
    ]
```

### Commands

[](#commands)

#### Sync Assets

[](#sync-assets)

Sync all assets but deletes old files that are on CDN.

```
php artisan cdn:sync {theme} {--delete-old}

```

- delete-old option enables automatic deletion of old files that does not exist in local folder

#### Push Assets

[](#push-assets)

Pushes assets but does not delete old files on CDN.

```
php artisan cdn:push {theme}

```

#### Delete all assets from CDN

[](#delete-all-assets-from-cdn)

Deletes all assets from CDN.

```
php artisan cdn:clear {theme}

```

### Twig Functions

[](#twig-functions)

- Replace `'path'|theme` with `asset_cdn('path')` (It can read manifest.json file if option **useManifest** is set to true in config).
- Replace any asset that is going out of asset theme directory or is not used in manifest with `cdn('path')`.

*Inspired by AsssetCDN package for Laravel *

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.5% 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 ~103 days

Total

2

Last Release

2117d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3110002?v=4)[Samuel](/maintainers/Samuell1)[@Samuell1](https://github.com/Samuell1)

---

Top Contributors

[![Samuell1](https://avatars.githubusercontent.com/u/3110002?v=4)](https://github.com/Samuell1 "Samuell1 (65 commits)")[![gergo85](https://avatars.githubusercontent.com/u/2959112?v=4)](https://github.com/gergo85 "gergo85 (1 commits)")

---

Tags

aws-s3cdnlaravel-mixmanifest-jsonoctobercms-pluginvitejswebpackcdnsyncoctobercmsmanifest

### Embed Badge

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

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

###  Alternatives

[deliciousbrains/wp-amazon-s3-and-cloudfront

Automatically copies media uploads to a storage provider's bucket for delivery. Optionally configure a CDN for even faster delivery.

310213.3k1](/packages/deliciousbrains-wp-amazon-s3-and-cloudfront)[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)[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)[arubacao/asset-cdn

Serve Laravel Assets from a Content Delivery Network (CDN)

111190.3k](/packages/arubacao-asset-cdn)[frosh/platform-thumbnail-processor

This plugins allows you to use variable thumbnails, without having them on storage.

21104.4k2](/packages/frosh-platform-thumbnail-processor)

PHPackages © 2026

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