All Projects → Superbalist → Flysystem Google Cloud Storage

Superbalist / Flysystem Google Cloud Storage

Licence: mit
Flysystem Adapter for Google Cloud Storage

Projects that are alternatives of or similar to Flysystem Google Cloud Storage

Google Cloud Cpp
C++ Client Libraries for Google Cloud Services
Stars: ✭ 233 (-1.69%)
Mutual labels:  google-cloud, google-cloud-platform, google-cloud-storage
Laravel Google Cloud Storage
A Google Cloud Storage filesystem for Laravel
Stars: ✭ 415 (+75.11%)
Mutual labels:  google-cloud, google-cloud-platform, google-cloud-storage
Berglas
A tool for managing secrets on Google Cloud
Stars: ✭ 959 (+304.64%)
Mutual labels:  google-cloud, google-cloud-storage
Fog Google
Fog for Google Cloud Platform
Stars: ✭ 83 (-64.98%)
Mutual labels:  google-cloud, google-cloud-platform
Unity Solutions
Use Firebase tools to incorporate common features into your games!
Stars: ✭ 95 (-59.92%)
Mutual labels:  google-cloud, google-cloud-platform
Dataflow Tutorial
Cloud Dataflow Tutorial for Beginners
Stars: ✭ 17 (-92.83%)
Mutual labels:  google-cloud-platform, google-cloud-storage
Terraform Google Vault
Terraform module to deploy Vault as a container on Google Cloud Run
Stars: ✭ 25 (-89.45%)
Mutual labels:  google-cloud, google-cloud-platform
Grpc Gke Nlb Tutorial
gRPC load-balancing on GKE using Envoy
Stars: ✭ 42 (-82.28%)
Mutual labels:  google-cloud, google-cloud-platform
Functions Samples
Collection of sample apps showcasing popular use cases using Cloud Functions for Firebase
Stars: ✭ 10,576 (+4362.45%)
Mutual labels:  google-cloud-platform, google-cloud-storage
Kubernetes Nexus
Run Sonatype Nexus Repository Manager OSS on top of Kubernetes (GKE). Includes instructions for automated backups (GCS) and day-to-day usage.
Stars: ✭ 122 (-48.52%)
Mutual labels:  google-cloud, google-cloud-storage
Gcpsketchnote
If you are looking to become a Google Cloud Engineer , then you are at the right place. GCPSketchnote is series where I share Google Cloud concepts in quick and easy to learn format.
Stars: ✭ 2,631 (+1010.13%)
Mutual labels:  google-cloud, google-cloud-platform
Cloud Functions Go
Unofficial Native Go Runtime for Google Cloud Functions
Stars: ✭ 427 (+80.17%)
Mutual labels:  google-cloud, google-cloud-platform
Gcping
Like gcping.com but a command line tool
Stars: ✭ 153 (-35.44%)
Mutual labels:  google-cloud, google-cloud-platform
Django Cloud Tasks
Integrate Google Cloud Tasks with Django
Stars: ✭ 27 (-88.61%)
Mutual labels:  google-cloud, google-cloud-platform
All About Programming
Everything about programming!!
Stars: ✭ 314 (+32.49%)
Mutual labels:  google-cloud, google-cloud-platform
gcp-firewall-enforcer
A toolbox to enforce firewall rules across multiple GCP projects.
Stars: ✭ 77 (-67.51%)
Mutual labels:  google-cloud, google-cloud-platform
pipeline-editor
Cloud Pipelines Editor is a web app that allows the users to build and run Machine Learning pipelines without having to set up development environment.
Stars: ✭ 22 (-90.72%)
Mutual labels:  google-cloud, google-cloud-platform
rowy
Open-source Airtable-like experience for your database (Firestore) with GCP's scalability. Build any automation or cloud functions for your product. ⚡️✨
Stars: ✭ 2,676 (+1029.11%)
Mutual labels:  google-cloud, google-cloud-platform
Crmint
Reliable data integration & processing for advertisers
Stars: ✭ 106 (-55.27%)
Mutual labels:  google-cloud-platform, google-cloud-storage
Gcp Audit
A tool for auditing security properties of GCP projects.
Stars: ✭ 140 (-40.93%)
Mutual labels:  google-cloud, google-cloud-platform

flysystem-google-cloud-storage

A Google Cloud Storage adapter for flysystem - a PHP filesystem abstraction.

Author Build Status StyleCI Software License Packagist Version Total Downloads

Installation

composer require superbalist/flysystem-google-storage

Integrations

Want to get started quickly? Check out some of these integrations:

Usage

use Google\Cloud\Storage\StorageClient;
use League\Flysystem\Filesystem;
use Superbalist\Flysystem\GoogleStorage\GoogleStorageAdapter;

/**
 * The credentials will be auto-loaded by the Google Cloud Client.
 *
 * 1. The client will first look at the GOOGLE_APPLICATION_CREDENTIALS env var.
 *    You can use ```putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json');``` to set the location of your credentials file.
 *
 * 2. The client will look for the credentials file at the following paths:
 * - windows: %APPDATA%/gcloud/application_default_credentials.json
 * - others: $HOME/.config/gcloud/application_default_credentials.json
 *
 * If running in Google App Engine, the built-in service account associated with the application will be used.
 * If running in Google Compute Engine, the built-in service account associated with the virtual machine instance will be used.
 */

$storageClient = new StorageClient([
    'projectId' => 'your-project-id',
]);
$bucket = $storageClient->bucket('your-bucket-name');

$adapter = new GoogleStorageAdapter($storageClient, $bucket);

$filesystem = new Filesystem($adapter);

/**
 * The credentials are manually specified by passing in a keyFilePath.
 */

$storageClient = new StorageClient([
    'projectId' => 'your-project-id',
    'keyFilePath' => '/path/to/service-account.json',
]);
$bucket = $storageClient->bucket('your-bucket-name');

$adapter = new GoogleStorageAdapter($storageClient, $bucket);

$filesystem = new Filesystem($adapter);

// write a file
$filesystem->write('path/to/file.txt', 'contents');

// update a file
$filesystem->update('path/to/file.txt', 'new contents');

// read a file
$contents = $filesystem->read('path/to/file.txt');

// check if a file exists
$exists = $filesystem->has('path/to/file.txt');

// delete a file
$filesystem->delete('path/to/file.txt');

// rename a file
$filesystem->rename('filename.txt', 'newname.txt');

// copy a file
$filesystem->copy('filename.txt', 'duplicate.txt');

// delete a directory
$filesystem->deleteDir('path/to/directory');

// see http://flysystem.thephpleague.com/api/ for full list of available functionality

Google Storage specifics

When using a custom storage uri the bucket name will not prepended to the file path.

$storageClient = new StorageClient([
    'projectId' => 'your-project-id',
]);
$bucket = $storageClient->bucket('your-bucket-name');
$adapter = new GoogleStorageAdapter($storageClient, $bucket);

// uri defaults to "https://storage.googleapis.com"
$filesystem = new Filesystem($adapter);
$filesystem->getUrl('path/to/file.txt');
// "https://storage.googleapis.com/your-bucket-name/path/to/file.txt"

// set custom storage uri
$adapter->setStorageApiUri('http://example.com');
$filesystem = new Filesystem($adapter);
$filesystem->getUrl('path/to/file.txt');
// "http://example.com/path/to/file.txt"

// You can also prefix the file path if needed.
$adapter->setStorageApiUri('http://example.com');
$adapter->setPathPrefix('extra-folder/another-folder/');
$filesystem = new Filesystem($adapter);
$filesystem->getUrl('path/to/file.txt');
// "http://example.com/extra-folder/another-folder/path/to/file.txt"
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].