2017 © Pedro Peláez
 

library l5-google-cloud-storage

Laravel 5 Flysystem Google Cloud Storage Service Provider

image

websight/l5-google-cloud-storage

Laravel 5 Flysystem Google Cloud Storage Service Provider

  • Friday, March 23, 2018
  • by cedricziel
  • Repository
  • 3 Watchers
  • 33 Stars
  • 33,364 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 14 Forks
  • 7 Open issues
  • 9 Versions
  • 5 % Grown

The README.md

Google Cloud Storage ServiceProvider for Laravel 5 Apps

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Wraps cedricziel/flysystem-gcs in a Laravel 5.x compatible Service Provider., (*2)

Note: This project doesn't support the deprecated p12 credentials format anymore. If you rely on it, please use the 1.x versions., (*3)

Configuration

Dedicated credentials: Obtain json service account credentials of a dedicated CloudPlatform Service Account, (*4)

or, (*5)

Local authentication through gcloud: Log in locally on your machine through the gcloud command-line utility., (*6)

  • Add the service provider to your application in config/app.php, (*7)

    Websight\GcsProvider\CloudStorageServiceProvider::class,
    
  • Add a disk to the disks array in config/filesystems.php, (*8)

    'gcs' => [
      // Select the Google Cloud Storage Disk
      'driver'         => 'gcs',
      // OPTIONAL: The location of the json service account certificate, see below
      // 'credentials' => storage_path('my-service-account-credentials.json'),
      // OPTIONAL: The GCP project id, see below
      // 'project_id'  => 'my-project-id-4711',
      // The bucket you want this disk to point at
      'bucket'         => 'my-project-id-4711.appspot.com',
    ],
    
  • If Google Cloud Storage is the only cloud disk, you may consider setting it as the cloud disk, so that you can access it like Storage::cloud()->$operation() via 'cloud' => 'gcs', in the filesystems.php config file., (*9)

Authentication and the different configuration options

Google Cloud Platform uses json credential files. For the use-case of this library, there are two different types that can easily confuse you., (*10)

  1. credentials type user This is the type of credentials that identifies you as a user entity, most likely when authenticated through the gcloud utility. Since this type of credentials identifies users and users can belong to more than one project, you need to specify the project_id config option. The keys should automatically be detected through their well-known location.
  2. credentials type service_account Service Account credentials are for authorizing machines and / or individual services to Google Cloud Platform. AppEngine instances and GCE machines already have a service account pre-installed so you don't need to configure neither project_id not credentials, since service accounts carry the information to which project they belong.

When do I need to configure which option?

Location project_id credentials bucket
AppEngine (Standard & Flex) detected automatically detected automatically needs to be set
Deployment to non-GCP machine needs to be set needs to be set needs to be set
Local development with user credentials needs to be set detected automatically needs to be set
Local development with service account detected automatically needs to be set needs to be set

Usage

Use it like any other Flysystem Adapter with the Storage-Facade., (*11)

$disk = Storage::disk('gcs');

// Put a private file on the 'gcs' disk which is a Google Cloud Storage bucket
$disk->put('test.png', file_get_contents(storage_path('app/test.png')));

// Put a public-accessible file on the 'gcs' disk which is a Google Cloud Storage bucket
$disk->put(
    'test-public.png',
    file_get_contents(storage_path('app/test-public.png')),
    \Illuminate\Contracts\Filesystem\Filesystem::VISIBILITY_PUBLIC
);

// Retrieve a file
$file = $disk->get('test.png');

License

MIT, (*12)

The Versions

23/03 2018

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/websightgmbh/l5-google-cloud-storage

Laravel 5 Flysystem Google Cloud Storage Service Provider

  Sources   Download

MIT

The Requires

 

by Cedric Ziel

laravel laravel5 flysystem

23/03 2018

v1.1.1

1.1.1.0 https://github.com/websightgmbh/l5-google-cloud-storage

Laravel 5 Flysystem Google Cloud Storage Service Provider

  Sources   Download

MIT

The Requires

 

by Cedric Ziel

laravel laravel5 flysystem

23/03 2018

dev-master

9999999-dev https://github.com/websightgmbh/l5-google-cloud-storage

Laravel 5 Flysystem Google Cloud Storage Service Provider

  Sources   Download

MIT

The Requires

 

The Development Requires

by Cedric Ziel

laravel lumen laravel5 flysystem

23/03 2018
21/09 2016

v1.1.0

1.1.0.0 https://github.com/websightgmbh/l5-google-cloud-storage

Laravel 5 Flysystem Google Cloud Storage Service Provider

  Sources   Download

MIT

The Requires

 

by Cedric Ziel

laravel laravel5 flysystem

04/03 2016

1.0.3

1.0.3.0 https://github.com/websightgmbh/l5-google-cloud-storage

Laravel 5 Flysystem Google Cloud Storage Service Provider

  Sources   Download

MIT

The Requires

 

by Cedric Ziel

laravel laravel5 flysystem

04/01 2016

1.0.2

1.0.2.0 https://github.com/websightgmbh/l5-google-cloud-storage

Laravel 5 Flysystem Google Cloud Storage Service Provider

  Sources   Download

MIT

The Requires

 

by Cedric Ziel

laravel laravel5 flysystem

27/11 2015

1.0.1

1.0.1.0 https://github.com/websightgmbh/l5-google-cloud-storage

Laravel 5 Flysystem Google Cloud Storage Service Provider

  Sources   Download

MIT

The Requires

 

by Cedric Ziel

laravel laravel5 flysystem

27/11 2015

1.0.0

1.0.0.0 https://github.com/websightgmbh/l5-google-cloud-storage

Laravel 5 Flysystem Google Cloud Storage Service Provider

  Sources   Download

MIT

The Requires

 

by Cedric Ziel

laravel laravel5 flysystem