Giter VIP home page Giter VIP logo

Comments (2)

jeremyj11 avatar jeremyj11 commented on June 2, 2024 4

Easy enough to add a service provider

namespace App\Providers;

use BunnyCDN\Storage\BunnyCDNStorage;
use Illuminate\Support\ServiceProvider;
use League\Flysystem\Filesystem;
use PlatformCommunity\Flysystem\BunnyCDN\BunnyCDNAdapter;
use Storage;

class BunnycdnServiceProvider extends ServiceProvider
{
    public function boot()
    {
        Storage::extend('bunnycdn', function ($app, $config) {
            $client = new BunnyCDNStorage(
                $config['zone'],
                $config['key']
            );

            //disable_asserts is needed otherwise delete call fails as file is not found somehow even though exists
            $config = ['disable_asserts' => true];

            return new Filesystem(new BunnyCDNAdapter($client), $config);
        });
    }

    public function register()
    {
        //
    }
}

and add to your disks in config filesystems.php

'disks' => [
        'bunnycdn' => [
            'driver' => 'bunnycdn',
            'zone' => '',
            'key' => '',
            'base_url' => '',
            'token' => '',
        ],

from flysystem-bunnycdn.

sifex avatar sifex commented on June 2, 2024

Super cool work @jeremyj11, thanks for that. I also found a package implimentation here as well:
https://github.com/Katzen48/laravel-bunnycdn

from flysystem-bunnycdn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.