sausin / laravel-ovh by sausin

OVH Object Storage driver for laravel
98,409
37
4
Package Data
Maintainer Username: sausin
Maintainer Contact: saurabh.singhvi@gmail.com (Saurabh Singhvi)
Package Create Date: 2017-03-16
Package Last Update: 2024-03-27
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-04-25 15:06:04
Package Statistics
Total Downloads: 98,409
Monthly Downloads: 2,954
Daily Downloads: 136
Total Stars: 37
Total Watchers: 4
Total Forks: 12
Total Open Issues: 0

Laravel OVH Object Storage driver

Latest Version on Packagist Build Status Quality Score StyleCI Total Downloads License: MIT

Laravel Storage facade provides support for many different filesystems.

This is a wrapper to combine others' work to integrate with laravel and provide support for OVH Object Storage.

Installing

Install via composer:

composer require sausin/laravel-ovh

Note: Branch 1.2.x works for PHP versions < 7.2

Then include the service provider in config/app.php

Sausin\LaravelOvh\OVHServiceProvider::class

in the providers array. This step is not required for Laravel 5.5 and above as the service provider is automatically registered!

Define the ovh driver in the config/filesystems.php as below

'ovh' => [
    'server' => env('OVH_URL'),
    'driver' => 'ovh',
    'user' => env('OVH_USER'),
    'pass' => env('OVH_PASS'),
    'region' => env('OVH_REGION'),
    'tenantName' => env('OVH_TENANT_NAME'),
    'container' => env('OVH_CONTAINER'),
    'projectId' => env('OVH_PROJECT_ID'),
    'urlKey' => env('OVH_URL_KEY'),
],

define the correct env variables above in your .env file (to correspond to the values above) and you should now have a working OVH Object Storage setup :)

Be sure to run

php artisan config:cache

again if you've been using the caching on your config file.

Usage

Refer to extensive laravel documentation for usage. Of note - this package includes support for the following additional methods:

Storage::url()

and

Storage::temporaryUrl()

The temporary url is relevant for private containers where files are not publicly accessible under normal conditions. This generates a temporary url with expiry (see details here for usage).

Note that this requires the container to have a proper header. The key in the header should match the urlKey specified in filesystems.php. For details on how to setup the header on your OVH container, see here.

Credits