Member-only story
Using Digital Ocean Spaces with Laravel
Storing file in Digitalocean spaces
Digital Ocean Spaces is a service much like AWS S3 that allows users to save files. Spaces uses an API that mirrors that of S3 means it is 100% compatible with AWS S3. Spaces have a built-in CDN that makes data storage and delivery easy, reliable and affordable.
The price? DO Spaces offer $5 per month, you get 250GB of storage and 1TB of bandwidth included. Extra storage costs is $0.02 per GB and additional bandwidth is just $0.01 per GB. It is very affordable cloud file storage provided by Digital Ocean compared to Amazon S3. If budget are your concern, DO Spaces are good to go.
Setting Up
Out of the box, Laravel provides support for S3 and the DO Spaces has a S3 compatible API for the flysystem driver. So, make sure you have already pulled in the FlySystem S3 drivers into your Laravel project. If not, install below package.
> composer require league/flysystem-aws-s3-v3
Creating Spaces
Creating your first Space automatically starts your Spaces subscription. Your subscription automatically ends when you destroy all of your Spaces. You can create a Space at any time from the Create menu by selecting Spaces and it will take you to the Create a Space page. You may follow the steps below:-