PHPackages                             yaza/laravel-google-drive-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. yaza/laravel-google-drive-storage

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

yaza/laravel-google-drive-storage
=================================

This is my package laravel-google-drive-storage

V5.0.0(1mo ago)207214.0k—8.3%45[3 issues](https://github.com/yaza-putu/laravel-google-drive-storage/issues)[3 PRs](https://github.com/yaza-putu/laravel-google-drive-storage/pulls)3MITPHPPHP ^8.3CI failing

Since Dec 1Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/yaza-putu/laravel-google-drive-storage)[ Packagist](https://packagist.org/packages/yaza/laravel-google-drive-storage)[ Docs](https://github.com/yaza-putu/laravel-google-drive-storage)[ RSS](/packages/yaza-laravel-google-drive-storage/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (28)Versions (16)Used By (3)

laravel-google-drive-storage
============================

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

[![gdrive](https://camo.githubusercontent.com/6fee949f62af80abaecf808a4d1e42c42655f5e8aefeba79b7831bb20ce6ca0f/68747470733a2f2f6973342d73736c2e6d7a7374617469632e636f6d2f696d6167652f7468756d622f507572706c653132322f76342f64392f63622f61382f64396362613862312d383561302d373233612d336630332d6264633662373634373664352f6c6f676f5f64726976655f3230323071345f636f6c6f722d302d31785f55303037656d61726b6574696e672d302d302d302d362d302d302d302d38352d3232302e706e672f313230307836333077612e706e67)](https://camo.githubusercontent.com/6fee949f62af80abaecf808a4d1e42c42655f5e8aefeba79b7831bb20ce6ca0f/68747470733a2f2f6973342d73736c2e6d7a7374617469632e636f6d2f696d6167652f7468756d622f507572706c653132322f76342f64392f63622f61382f64396362613862312d383561302d373233612d336630332d6264633662373634373664352f6c6f676f5f64726976655f3230323071345f636f6c6f722d302d31785f55303037656d61726b6574696e672d302d302d302d362d302d302d302d38352d3232302e706e672f313230307836333077612e706e67)This package allow to store and get data from google drive like S3 AWS in laravel

Support
-------

[](#support)

- laravel 13 (php 8.2) use V5.x
- laravel 12 (php 8.2) use V4.x
- Laravel 11 (php 8.2) use V3.x
- Laravel 10 (php 8.1) use V2.0.0

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

[](#installation)

You can install the package via composer:

```
composer require yaza/laravel-google-drive-storage
```

copy to .env

```
FILESYSTEM_CLOUD=google
GOOGLE_DRIVE_CLIENT_ID=xxx.apps.googleusercontent.com
GOOGLE_DRIVE_CLIENT_SECRET=xxx
GOOGLE_DRIVE_REFRESH_TOKEN=xxx
GOOGLE_DRIVE_ACCESS_TOKEN=xxx
GOOGLE_DRIVE_FOLDER=
```

config filesystem.php

```
'disks' => [
    'google' => [
      'driver' => 'google',
      'clientId' => env('GOOGLE_DRIVE_CLIENT_ID'),
      'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
      'accessToken' => env('GOOGLE_DRIVE_ACCESS_TOKEN'), // optional
      'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN'),
      'folder' => env('GOOGLE_DRIVE_FOLDER'),
    ]
]
```

Setup Google Keys
-----------------

[](#setup-google-keys)

- [Getting your Client ID and Secret](https://github.com/ivanvermeyen/laravel-google-drive-demo/blob/master/README/1-getting-your-dlient-id-and-secret.md)
- [Getting your Refresh Token](https://github.com/ivanvermeyen/laravel-google-drive-demo/blob/master/README/2-getting-your-refresh-token.md)

Usage
-----

[](#usage)

you can use storage driver function by laravel
example :

```
 Storage::disk('google')->put($filename, File::get($filepath));
```

refrensi code opration [sample code](https://github.com/ivanvermeyen/laravel-google-drive-demo/blob/master/routes/web.php)

Usage with `accessToken`. Could be useful if you want to use your user's token e.g upload a file in their own Drive.

```
// Build an on-demand disk
$disk = Storage::build([
    'driver' => 'google',
    'clientId' => env('GOOGLE_DRIVE_CLIENT_ID'),
    'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
    'accessToken' => auth()->user()->google_access_token, // Get from authenticated user
    'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN'),
    'folder' => env('GOOGLE_DRIVE_FOLDER'),
]);

$disk->put($filename, File::get($filepath));
```

or use helper from this package
- Put File

```
use Yaza\LaravelGoogleDriveStorage\Gdrive;

Gdrive::put('location/filename.png', $request->file('file'));
// or
Gdrive::put('filename.png', public_path('path/filename.png'));
```

- Get File

```
use Yaza\LaravelGoogleDriveStorage\Gdrive;

$data = Gdrive::get('path/filename.png');

return response($data->file, 200)
    ->header('Content-Type', $data->ext);
```

- Get Large File with stream

```
use Yaza\LaravelGoogleDriveStorage\Gdrive;

  $readStream = Gdrive::readStream('path/filename.png');

return response()->stream(function () use ($readStream) {
    fpassthru($readStream->file);
}, 200, [
    'Content-Type' => $readStream->ext,
    //'Content-disposition' => 'attachment; filename="'.$filename.'"', // force download?
]);
```

- download file

```
use Yaza\LaravelGoogleDriveStorage\Gdrive;

 $data = Gdrive::get('path/filename.png');
        return response($data->file, 200)
            ->header('Content-Type', $data->ext)
            ->header('Content-disposition', 'attachment; filename="'.$data->filename.'"');
```

- delete

```
use Yaza\LaravelGoogleDriveStorage\Gdrive;

 Gdrive::delete('path/filename.png');
```

- delete directory

```
use Yaza\LaravelGoogleDriveStorage\Gdrive;

  Gdrive::deleteDir('foldername');
```

- make directory

```
use Yaza\LaravelGoogleDriveStorage\Gdrive;

  Gdrive::makeDir('foldername');
```

- rename directory

```
use Yaza\LaravelGoogleDriveStorage\Gdrive;

  Gdrive::renameDir('oldfolderpath', 'newfolder');
```

- all folder &amp; file

```
use Yaza\LaravelGoogleDriveStorage\Gdrive;

Gdrive::all('/');
// or
Gdrive::all('foldername');
```

output

```
Illuminate\Support\Collection {#804 ▼ // app/Http/Controllers/UploadController.php:70
  #items: array:3 [▼
    0 => League\Flysystem\DirectoryAttributes {#798 ▶}
    1 => League\Flysystem\FileAttributes {#796 ▶}
    2 => League\Flysystem\DirectoryAttributes {#783 ▶}
  ]
  #escapeWhenCastingToString: false
}
```

- all folder &amp; file with sub folder

```
use Yaza\LaravelGoogleDriveStorage\Gdrive;

Gdrive::all('/', true);
// or
Gdrive::all('foldername', true);
```

output

```
Illuminate\Support\Collection {#804 ▼ // app/Http/Controllers/UploadController.php:70
  #items: array:3 [▼
    0 => League\Flysystem\DirectoryAttributes {#798 ▶}
    1 => League\Flysystem\FileAttributes {#796 ▶}
    2 => League\Flysystem\DirectoryAttributes {#783 ▶}
  ]
  #escapeWhenCastingToString: false
}
```

Limitations
-----------

[](#limitations)

Using display paths as identifiers for folders and files requires them to be unique. Unfortunately Google Drive allows users to create files and folders with same (displayed) names. In such cases when unique path cannot be determined this adapter chooses the oldest (first) instance. In case the newer duplicate is a folder and user puts a unique file or folder inside the adapter will be able to reach it properly (because full path is unique).

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [yaza](https://github.com/yaza-putu)
- [All Contributors](../../contributors)

Thanks to [Masbug](https://github.com/masbug/flysystem-google-drive-ext)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity54

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 77.1% 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.

###  Release Activity

Cadence

Every ~125 days

Recently: every ~181 days

Total

11

Last Release

55d ago

Major Versions

V1.1.4 → V2.0.02023-09-20

V2.0.0 → V3.0.02024-05-11

V3.0.0 → V4.0.02025-03-12

V4.1.0 → V5.0.02026-05-09

PHP version history (4 changes)V1.0.0PHP ^8.1

V3.0.0PHP ^8.2

V4.0.0PHP ^8.4

V5.0.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/437346?v=4)[Troy](/maintainers/yaza)[@yaza](https://github.com/yaza)

---

Top Contributors

[![yaza-putu](https://avatars.githubusercontent.com/u/59905886?v=4)](https://github.com/yaza-putu "yaza-putu (64 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![RizkySugiharto](https://avatars.githubusercontent.com/u/87899571?v=4)](https://github.com/RizkySugiharto "RizkySugiharto (2 commits)")[![Asociateone](https://avatars.githubusercontent.com/u/61870393?v=4)](https://github.com/Asociateone "Asociateone (2 commits)")[![acgonzales](https://avatars.githubusercontent.com/u/44025870?v=4)](https://github.com/acgonzales "acgonzales (1 commits)")[![shoaibsharif](https://avatars.githubusercontent.com/u/29075110?v=4)](https://github.com/shoaibsharif "shoaibsharif (1 commits)")[![SPQRBrutus](https://avatars.githubusercontent.com/u/6303506?v=4)](https://github.com/SPQRBrutus "SPQRBrutus (1 commits)")[![yasa32putu](https://avatars.githubusercontent.com/u/169970895?v=4)](https://github.com/yasa32putu "yasa32putu (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")

---

Tags

laravel-google-drivelaravel-google-drive-storagelaravel-storagelaravel-google-drive-storage

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.6k3](/packages/defstudio-telegraph)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[filament/support

Core helper methods and foundation code for all Filament packages.

2331.0M245](/packages/filament-support)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

44855.7k](/packages/harris21-laravel-fuse)

PHPackages © 2026

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