Giter Club home page Giter Club logo

laravel-object-storage's Introduction

A flysystem driver for fortrabbit's Object Storage

Install

The most recent version (2.x) is compatible with Laravel 9 and 10

# For laravel 9 and 10
composer require fortrabbit/laravel-object-storage

# For laravel 6,7,8 
composer require fortrabbit/laravel-object-storage:^1.4

Configure the 'object-storage' driver

You are free to choose the disk name. In this example it is s3, but it's up to you.

# config/filesystems.php

// ...
'disks' => [
    's3' => [
        'driver' => 'object-storage'
    ]
],

Environment variables for Object Storage access are available automatically on fortrabbit. For local access you need to set them.

# local .env

OBJECT_STORAGE_KEY="{your-app-name}"
OBJECT_STORAGE_SECRET="{object-storage-secrect}"
OBJECT_STORAGE_REGION="{eu-west-1 or us-west-1} "
OBJECT_STORAGE_BUCKET="{your-app-name}"
OBJECT_STORAGE_SERVER="objects.{region}.frbit.com"
OBJECT_STORAGE_URL="https://{your-app-name}.objects.frb.io"

laravel-object-storage's People

Contributors

abenevaut avatar alexpestell avatar ostark avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laravel-object-storage's Issues

Laravel 10 Support

Dependency conflict for illuminate/filesystem and illuminate/support between fortrabbit/laravel-object-storage and laravel/framework, but from what I could see there have been no breaking changes, so only the composer.json would need to be updated to allow both ^9.0 and ^10.0 for those illuminate packages.

Laravel 9 support

This might be more than an version bump on laravel/framework.
Review league/flysystem 1.0 >> 3.0 changes

This driver does not support retrieving URLs

Trying to do Storage::url($path) on an object-storage disk will throw the error This driver does not support retrieving URLs..

Solution seems to be easy enough, something like this should suffice (untested):

    public function getUrl(string $path)
    {
        return 'https://' . env('OBJECT_STORAGE_HOST') . '/' . $path;
    }

Reading directory throws `Undefined constant "League\Flysystem\AwsS3V3\EXTRA_METADATA_FIELDS"`

When reading files of a directory, this throws the error Undefined constant "League\Flysystem\AwsS3V3\EXTRA_METADATA_FIELDS".

This is because of a known issue on the flysystem AwsS3V3 adapter where private const EXTRA_METADATA_FIELDS is declared private.

(see https://github.com/thephpleague/flysystem-aws-s3-v3/issues/252)

Until that is fixed, the fix for this is to declare inside fortrabbit\ObjectStorage\ObjectStorageAdapter:

    public const EXTRA_METADATA_FIELDS = [
        'Metadata',
        'StorageClass',
        'ETag',
        'VersionId',
    ];

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.