LaravelPackages.net
Acme Inc.
Toggle sidebar
grandwebdesign/digitalocean-spaces-laravel

This package will help uploading and removing assets to digitalocean spaces

60
0
1.2.2
About grandwebdesign/digitalocean-spaces-laravel

grandwebdesign/digitalocean-spaces-laravel is a Laravel package for this package will help uploading and removing assets to digitalocean spaces. It currently has 0 GitHub stars and 60 downloads on Packagist (latest version 1.2.2). Install it with composer require grandwebdesign/digitalocean-spaces-laravel. Discover more Laravel packages by grandwebdesign or browse all Laravel packages to compare alternatives.

Last updated

DigitalOcean Spaces for Laravel

This package provides easy integration and management of DigitalOcean Spaces in Laravel applications.

Requirements

  • PHP >= 8.1
  • Laravel >= 10.0

Installation

To install the package via Composer:

composer require grandwebdesign/digitalocean-spaces-laravel

Configuration

Once you've installed the package, set the following environment variables in your .env file:

DO_ACCESS_KEY_ID=
DO_SECRET_ACCESS_KEY=
DO_DEFAULT_REGION=
DO_BUCKET=
DO_CDN_ENDPOINT=
DO_ENDPOINT=
DO_FOLDER=

Note on DO_FOLDER: This variable can remain empty if you want to upload files to the root directory. Otherwise, specify a folder name, such as "uploads", so all files will be uploaded to the /uploads/ path.

If you want to compress the image files as you upload you also need to specify your TinyPNG API key to your .env file.

TINIFY_API_KEY=

Usage

To upload a file

use Grandwebdesign\DigitaloceanSpacesLaravel\DigitaloceanSpaces;

$digitaloceanSpace = new DigitaloceanSpaces(
    file: $this->file('image'),
    folder: '',
    fileName: 'filename.png'
);

$fileName = $digitaloceanSpace->upload();

To remove a file

use Grandwebdesign\DigitaloceanSpacesLaravel\DigitaloceanSpaces;

$digitaloceanSpace = new DigitaloceanSpaces(
    file: 'filename.png',
);

$fileName = $digitaloceanSpace->delete();
Comments