PHPackages                             devmagellan/flysystem-google-storage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. devmagellan/flysystem-google-storage

ActiveLibrary[File &amp; Storage](/categories/file-storage)

devmagellan/flysystem-google-storage
====================================

Flysystem adapter for Google Cloud Storage

01PHP

Since Aug 14Pushed 3y ago1 watchersCompare

[ Source](https://github.com/imediasun/flysystem-google-storage)[ Packagist](https://packagist.org/packages/devmagellan/flysystem-google-storage)[ RSS](/packages/devmagellan-flysystem-google-storage/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

flysystem-google-cloud-storage
==============================

[](#flysystem-google-cloud-storage)

A Google Cloud Storage adapter for [flysystem](https://github.com/thephpleague/flysystem) - a PHP filesystem abstraction.

[![Author](https://camo.githubusercontent.com/95a4f30f354d177aca021a140bc8207697a68302a5f41183de02a20d516292a4/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d406465766d6167656c6c616e2d626c75652e7376673f7374796c653d666c61742d737175617265)](https://twitter.com/devmagellan)[![Build Status](https://camo.githubusercontent.com/e93ae8c43aaf4c2326574002446983208492fdc6c052464f990f013a96e8f2e3/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4465766d6167656c6c616e2f666c7973797374656d2d676f6f676c652d636c6f75642d73746f726167652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Devmagellan/flysystem-google-cloud-storage)[![StyleCI](https://camo.githubusercontent.com/f3c57a7b839651e0237c998546ee6c8c2dce0092911550e17b012348e0f2b5d9/68747470733a2f2f7374796c6563692e696f2f7265706f732f34343337303834332f736869656c643f6272616e63683d7374796c652d6369)](https://styleci.io/repos/44370843)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/abbb2cae179fe96e8687b82ddce931774ae40f430269a8eb9b10c54dfcd16e2f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465766d6167656c6c616e2f666c7973797374656d2d676f6f676c652d73746f726167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devmagellan/flysystem-google-storage)[![Total Downloads](https://camo.githubusercontent.com/97e90c52f7101683d9adebc7b7aecd28909a351fb980eaa3c02d14681f6f75d6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465766d6167656c6c616e2f666c7973797374656d2d676f6f676c652d73746f726167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devmagellan/flysystem-google-storage)

Installation
------------

[](#installation)

```
composer require devmagellan/flysystem-google-storage
```

Integrations
------------

[](#integrations)

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

- Laravel -

Usage
-----

[](#usage)

```
use Google\Cloud\Storage\StorageClient;
use League\Flysystem\Filesystem;
use Devmagellan\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
------------------------

[](#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"
```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/aafb873dc370255479b4d88803458d1c4fc8e4c36cefe659d82eaa857340ce6b?d=identicon)[devmagellan](/maintainers/devmagellan)

---

Top Contributors

[![devmagellan](https://avatars.githubusercontent.com/u/47326389?v=4)](https://github.com/devmagellan "devmagellan (1 commits)")

### Embed Badge

![Health badge](/badges/devmagellan-flysystem-google-storage/health.svg)

```
[![Health](https://phpackages.com/badges/devmagellan-flysystem-google-storage/health.svg)](https://phpackages.com/packages/devmagellan-flysystem-google-storage)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15161.6M2.6k](/packages/illuminate-filesystem)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)[madnest/madzipper

Easier zip file handling for Laravel applications.

1382.3M6](/packages/madnest-madzipper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
