Code Monkey home page Code Monkey logo

laravel-backblaze's Introduction

B2-Backblaze Storage Adapter for Laravel 5+

Latest Version on Packagist Total Downloads

Backblaze B2 is a cloud storage system comparable to Amazons S3. This adapter allows you to use B2 within Laravel 5+ applications. Tested are Laravel 5, 6, 7, and 8.

At bring your own ideas Ltd. it is used in combination with spatie's Laravel backup to backup our Laravel projects.

The code is based on Paul Olthofs unmaintained repo and addresses mostly bugs at this point.

Use B2 via S3 instead!

As B2 has an S3-compatible interface it's recommended to use this instead. See #6 (comment) for more details. It's unlikely this package will be maintained further and migrating is recommended.

Step by Step Guide

On our company website we have released a detailed step by step guide to back up your Laravel projects to Backblaze. Feel free to reach out if you find any mistakes or have trouble implementing the steps.

Installation

Via Composer

composer require bringyourownideas/laravel-backblaze

In your app.php config file add to the list of service providers:

\bringyourownideas\Backblaze\BackblazeServiceProvider::class,

Add the following to your filesystems.php config file in the disks section:

'b2' => [
    'driver'         => 'b2',
    'accountId'      => '',
    'applicationKey' => '',
    'bucketName'     => '',
],

Now just paste in your credentials and bucketname and you're ready to go!

Usage

Just use it as you normally would use the Storage facade.

\Storage::disk('b2')->put('test.txt', 'test')

and

\Storage::disk('b2')->get('test.txt')

Credits

License

MIT, as the original repository.

laravel-backblaze's People

Contributors

spekulatius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

laravel-backblaze's Issues

Started getting 404 on API endpoints, anyone else?

Specifically:

GuzzleHttp\Exception\ClientException: Client error: `GET https://api.backblazeb2.com/b2api/v1//b2_authorize_account` resulted in a `404 Not Found` response:
{
  "code": "not_found",
  "message": "/b2api/v1//b2_authorize_account",
  "status": 404
}

Anyone else?

Driver [b2] is not supported.

I'm using Laravel 8
I've installed the package.
Added the b2 key to the filesystems.php
Add settings from my backblaze to the .env file
cleared the cache
But when I run the app with this code

$fakeImage = $this->faker->image();
$fakeImageFile =  new File($fakeImage);
Storage::disk('b2')->putFile('images', $fakeImageFile);

I get an InvalidArguementException Exception with this message: Driver [b2] is not supported.

Can't use an application key

Hello !

Trying to use the adapter with an application key seems to always result in an unauthorized error... But working with the master application key works perfectly fine. Is this normal ?

Cant install with laravel 8

Laravel 8 now require guzzle 7.0.1 so composer fails:

Problem 1
    - cwhite92/b2-sdk-php[v1.2.0, ..., v1.3.0] require guzzlehttp/guzzle ^6.1 -> found guzzlehttp/guzzle[6.1.0, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.0.1).
    - gliterd/backblaze-b2[dev-analysis-qoj29N, dev-analysis-8w1029, 0.0.1, ..., 0.0.3, 1.0.0, ..., 1.1.1] require guzzlehttp/guzzle ^6.1 -> found guzzlehttp/guzzle[6.1.0, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.0.1).
    - gliterd/backblaze-b2[dev-feature/refactor, dev-release/1.2.0, dev-analysis-L3oKZl, 1.2.0, ..., 1.3.1] require php ^7.1.8 -> your php version (8.0.1) does not satisfy that requirement.
    - mhetreramesh/flysystem-backblaze[dev-release/1.5.0, dev-analysis-XZbavP, dev-analysis-q5p9Oy, 1.5.0, ..., 1.5.2] require php ^7.1.8 -> your php version (8.0.1) does not satisfy that requirement.
    - gliterd/backblaze-b2[dev-feature/update-dependencies, dev-master, dev-develop, dev-analysis-4xy9PE, 1.4.0, ..., 1.4.2] require php ^7.2 -> your php version (8.0.1) does not satisfy that requirement.
    - bringyourownideas/laravel-backblaze 2.0.0 requires mhetreramesh/flysystem-backblaze * -> satisfiable by mhetreramesh/flysystem-backblaze[dev-feature/Directory_Functions, dev-release/1.5.0, dev-scrutinizer-patch-1, dev-analysis-XZbavP, dev-analysis-q5p9Oy, 1.0.0, ..., 1.5.2].
    - mhetreramesh/flysystem-backblaze[1.1.0, ..., 1.1.4] require gliterd/backblaze-b2 * -> satisfiable by gliterd/backblaze-b2[dev-feature/update-dependencies, dev-feature/refactor, dev-master, dev-release/1.2.0, dev-develop, dev-analysis-L3oKZl, dev-analysis-qoj29N, dev-analysis-4xy9PE, dev-analysis-8w1029, 0.0.1, 0.0.2, 0.0.3, 1.0.0, ..., 1.4.2].
    - mhetreramesh/flysystem-backblaze[dev-feature/Directory_Functions, dev-scrutinizer-patch-1, 1.0.0, ..., 1.0.10] require cwhite92/b2-sdk-php ^1.2 -> satisfiable by cwhite92/b2-sdk-php[v1.2.0, v1.2.1, v1.3.0].
    - Root composer.json requires bringyourownideas/laravel-backblaze ^2.0 -> satisfiable by bringyourownideas/laravel-backblaze[2.0.0].

its not directly your problem, just letting you know

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.