PHPackages                             yodawy/laravel-google-cloud-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. yodawy/laravel-google-cloud-storage

ActiveLibrary

yodawy/laravel-google-cloud-storage
===================================

A Google Cloud Storage filesystem for Laravel

v1.0.0(2y ago)020MITPHPPHP &gt;=5.5.9

Since Dec 3Pushed 2y agoCompare

[ Source](https://github.com/selfeky/yodawy-laravel-google-cloud-storage)[ Packagist](https://packagist.org/packages/yodawy/laravel-google-cloud-storage)[ RSS](/packages/yodawy-laravel-google-cloud-storage/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

laravel-google-cloud-storage
============================

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

A Google Cloud Storage filesystem for Laravel.

[![Author](https://camo.githubusercontent.com/abd4e3e2e71081ad01ef09a60c49d70c5e0677497f38918e740703cd02605078/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d40737570657262616c6973742d626c75652e7376673f7374796c653d666c61742d737175617265)](https://twitter.com/superbalist)[![Build Status](https://camo.githubusercontent.com/55b1e562edb3b4bb2a25bfec8190ef69ed62fb913f87bc6c285d3e13e42a9490/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f537570657262616c6973742f6c61726176656c2d676f6f676c652d636c6f75642d73746f726167652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Superbalist/laravel-google-cloud-storage)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/954793d985f42981f50fb76477b31b27b8305161acf5f26a1873a256f6fe0eec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737570657262616c6973742f6c61726176656c2d676f6f676c652d636c6f75642d73746f726167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/superbalist/laravel-google-cloud-storage)[![Total Downloads](https://camo.githubusercontent.com/6cba68cacd36a838a7b1e48e77221e8d447078fcb8514374d7871153c650c3b0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f737570657262616c6973742f6c61726176656c2d676f6f676c652d636c6f75642d73746f726167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/superbalist/laravel-google-cloud-storage)

This package is a wrapper bridging [flysystem-google-storage](https://github.com/Superbalist/flysystem-google-storage) into Laravel as an available storage disk.

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

[](#installation)

```
composer require superbalist/laravel-google-cloud-storage
```

If you are on Laravel 5.4 or earlier, then register the service provider in app.php

```
'providers' => [
    // ...
    Superbalist\LaravelGoogleCloudStorage\GoogleCloudStorageServiceProvider::class,
]
```

If you are on Laravel 5.5 or higher, composer will have registered the provider automatically for you.

Add a new disk to your `filesystems.php` config

```
'gcs' => [
    'driver' => 'gcs',
    'project_id' => env('GOOGLE_CLOUD_PROJECT_ID', 'your-project-id'),
    'key_file' => env('GOOGLE_CLOUD_KEY_FILE', null), // optional: /path/to/service-account.json
    'bucket' => env('GOOGLE_CLOUD_STORAGE_BUCKET', 'your-bucket'),
    'path_prefix' => env('GOOGLE_CLOUD_STORAGE_PATH_PREFIX', null), // optional: /default/path/to/apply/in/bucket
    'storage_api_uri' => env('GOOGLE_CLOUD_STORAGE_API_URI', null), // see: Public URLs below
    'visibility' => 'public', // optional: public|private
],
```

### Authentication

[](#authentication)

The Google Client uses a few methods to determine how it should authenticate with the Google API.

1. If you specify a path in the key `key_file` in disk config, that json credentials file will be used.
2. If the `GOOGLE_APPLICATION_CREDENTIALS` env var is set, it will use that.

    ```
    putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json');
    ```
3. It will then try load the key file from a 'well known path':

    - windows: %APPDATA%/gcloud/application\_default\_credentials.json
    - others: $HOME/.config/gcloud/application\_default\_credentials.json
4. If running in **Google App Engine**, the built-in service account associated with the application will be used.
5. If running in **Google Compute Engine**, the built-in service account associated with the virtual machine instance will be used.
6. If you want to authenticate directly without using a json file, you can specify an array for `key_file` in disk config with this data:

    ```
    'key_file' => [
        'type' => env('GOOGLE_CLOUD_ACCOUNT_TYPE'),
        'private_key_id' => env('GOOGLE_CLOUD_PRIVATE_KEY_ID'),
        'private_key' => env('GOOGLE_CLOUD_PRIVATE_KEY'),
        'client_email' => env('GOOGLE_CLOUD_CLIENT_EMAIL'),
        'client_id' => env('GOOGLE_CLOUD_CLIENT_ID'),
        'auth_uri' => env('GOOGLE_CLOUD_AUTH_URI'),
        'token_uri' => env('GOOGLE_CLOUD_TOKEN_URI'),
        'auth_provider_x509_cert_url' => env('GOOGLE_CLOUD_AUTH_PROVIDER_CERT_URL'),
        'client_x509_cert_url' => env('GOOGLE_CLOUD_CLIENT_CERT_URL'),
    ],
    ```

### Public URLs

[](#public-urls)

The adapter implements a `getUrl($path)` method which returns a public url to a file.

> **Note:** Method available for Laravel 5.2 and higher. If used on 5.1, it will throw an exception.

```
$disk = Storage::disk('gcs');
$url = $disk->url('folder/my_file.txt');
>>> http://storage.googleapis.com/bucket-name/folder/my_file.txt
```

If you configure a `path_prefix` in your config:

```
$disk = Storage::disk('gcs');
$url = $disk->url('folder/my_file.txt');
>>> http://storage.googleapis.com/bucket-name/path-prefix/folder/my_file.txt
```

If you configure a custom `storage_api_uri` in your config:

```
$disk = Storage::disk('gcs');
$url = $disk->url('folder/my_file.txt');
>>> http://your-custom-domain.com/bucket-name/path-prefix/folder/my_file.txt
```

For a custom domain (storage api uri), you will need to configure a CNAME DNS entry pointing to `storage.googleapis.com`.

Please see  for further instructions.

Usage
-----

[](#usage)

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

// create a file
$disk->put('avatars/1', $fileContents);

// check if a file exists
$exists = $disk->exists('file.jpg');

// get file modification date
$time = $disk->lastModified('file1.jpg');

// copy a file
$disk->copy('old/file1.jpg', 'new/file1.jpg');

// move a file
$disk->move('old/file1.jpg', 'new/file1.jpg');

// get url to file
$url = $disk->url('folder/my_file.txt');

// Set the visibility of file to public
$disk->setVisibility('folder/my_file.txt', 'public');

// See https://laravel.com/docs/5.3/filesystem for full list of available functionality
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

891d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e3c1700fb0d1055b2af1cdad52a5b93595e316d1858fd33c9f3f40ad8e32faf?d=identicon)[selfeky](/maintainers/selfeky)

---

Top Contributors

[![matthewgoslett](https://avatars.githubusercontent.com/u/1571743?v=4)](https://github.com/matthewgoslett "matthewgoslett (19 commits)")[![nicja](https://avatars.githubusercontent.com/u/2102143?v=4)](https://github.com/nicja "nicja (8 commits)")[![selfeky](https://avatars.githubusercontent.com/u/886365?v=4)](https://github.com/selfeky "selfeky (4 commits)")[![Mombuyish](https://avatars.githubusercontent.com/u/8007787?v=4)](https://github.com/Mombuyish "Mombuyish (3 commits)")[![pierlon](https://avatars.githubusercontent.com/u/16200219?v=4)](https://github.com/pierlon "pierlon (2 commits)")[![shad0wfir3](https://avatars.githubusercontent.com/u/20926935?v=4)](https://github.com/shad0wfir3 "shad0wfir3 (2 commits)")[![zoidyzoidzoid](https://avatars.githubusercontent.com/u/2572493?v=4)](https://github.com/zoidyzoidzoid "zoidyzoidzoid (2 commits)")[![regiszanandrea](https://avatars.githubusercontent.com/u/2692748?v=4)](https://github.com/regiszanandrea "regiszanandrea (1 commits)")[![rommni](https://avatars.githubusercontent.com/u/907396?v=4)](https://github.com/rommni "rommni (1 commits)")[![shaunthegeek](https://avatars.githubusercontent.com/u/4971414?v=4)](https://github.com/shaunthegeek "shaunthegeek (1 commits)")[![necenzurat](https://avatars.githubusercontent.com/u/145449?v=4)](https://github.com/necenzurat "necenzurat (1 commits)")[![dgoguerra](https://avatars.githubusercontent.com/u/4779130?v=4)](https://github.com/dgoguerra "dgoguerra (1 commits)")[![jbaron-mx](https://avatars.githubusercontent.com/u/11150471?v=4)](https://github.com/jbaron-mx "jbaron-mx (1 commits)")[![jeroen-groenveld](https://avatars.githubusercontent.com/u/26757074?v=4)](https://github.com/jeroen-groenveld "jeroen-groenveld (1 commits)")[![johnmarkmassey](https://avatars.githubusercontent.com/u/7905749?v=4)](https://github.com/johnmarkmassey "johnmarkmassey (1 commits)")[![leewillis77](https://avatars.githubusercontent.com/u/1097338?v=4)](https://github.com/leewillis77 "leewillis77 (1 commits)")[![CasperLaiTW](https://avatars.githubusercontent.com/u/5094008?v=4)](https://github.com/CasperLaiTW "CasperLaiTW (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yodawy-laravel-google-cloud-storage/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[laravel/ui

Laravel UI utilities and presets.

2.7k134.9M601](/packages/laravel-ui)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[sammyjo20/lasso

Lasso - Asset wrangling for Laravel made simple.

355347.9k](/packages/sammyjo20-lasso)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

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