ekyna/digital-ocean-bundle

Deploy assets to digital ocean space CDN

0.7.x-dev 2020-12-14 13:58 UTC

This package is auto-updated.

Last update: 2024-04-04 12:38:49 UTC


README

Deploy assets to Digital Ocean space CDN

Installation

Install using composer:

composer require ekyna/digital-ocean-bundle

Register the bundle:

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Ekyna\Bundle\DigitalOceanBundle\EkynaDigitalOceanBundle(),
        ];
    }
}

Add the configuration:

ekyna_digital_ocean:
    api:
        token: YOUR_API_TOKEN
    spaces:
        -
            name: my-do-cdn # Must match space name on Digital Ocean 
            region: ams3
            key: SPACE_ACCESS_KEY
            secret: SPACE_ACCESS_SECRET
    usage:
        bundles: my-do-cdn # The space to use for assets deployment

Usage

Spaces storages are available as League\Flysystem\Filesystem (v1) services :

<!-- You can inject 'my-do-cdn' filesystem service -->
<service id="Acme\Some\Service">
    <argument type="service">ekyna_digital_ocean.my_do_cdn.filesystem</argument>
</service>

Commands

You can deploy bundles assets to your space CDN by running the following command:

php bin/console ekyna:digital-ocean:assets:deploy

Warning: it purge the entire CDN cache.