PHPackages                             feliximafidon/flysystem-google-drive - 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. feliximafidon/flysystem-google-drive

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

feliximafidon/flysystem-google-drive
====================================

Flysystem adapter for Google Drive, adapted from nao-pon/flysystem-google-drive

059PHP

Since Jul 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/feliximafidon/flysystem-google-drive)[ Packagist](https://packagist.org/packages/feliximafidon/flysystem-google-drive)[ RSS](/packages/feliximafidon-flysystem-google-drive/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Flysystem Adapter for Google Drive
==================================

[](#flysystem-adapter-for-google-drive)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

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

[](#installation)

```
composer require feliximafidon/flysystem-google-drive
```

Usage
-----

[](#usage)

#### Follow [Google Docs](https://developers.google.com/drive/v3/web/enable-sdk) to obtain your `ClientId, ClientSecret & refreshToken` in addition you can also check this [easy-to-follow tutorial](https://gist.github.com/ivanvermeyen/cc7c59c185daad9d4e7cb8c661d7b89b)

[](#follow-google-docs-to-obtain-your-clientid-clientsecret--refreshtoken-in-addition-you-can-also-check-this-easy-to-follow-tutorial)

- you can also check [This Example](https://github.com/nao-pon/flysystem-google-drive/blob/master/example/GoogleUpload.php) for a better understanding.

```
$client = new \Google_Client();
$client->setClientId('[app client id].apps.googleusercontent.com');
$client->setClientSecret('[app client secret]');
$client->refreshToken('[your refresh token]');

$service = new \Google_Service_Drive($client);

$adapter = new \IF\Flysystem\GoogleDrive\GoogleDriveAdapter($service, '['root' or folder ID]');
/* Recommended cached adapter use */
// $adapter = new \League\Flysystem\Cached\CachedAdapter(
//     new \Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter($service, '['root' or folder ID]'),
//     new \League\Flysystem\Cached\Storage\Memory()
// );

$filesystem = new \League\Flysystem\Filesystem($adapter);
```

### Usage to with [elFinder](https://github.com/Studio-42/elFinder)

[](#usage-to-with-elfinder)

```
composer require nao-pon/elfinder-flysystem-driver-ext
composer require feliximafidon/flysystem-google-drive:~1.1
```

```
// Load composer autoloader
require 'vender/autoload.php';

// Google API Client
$client = new \Google_Client();
$client->setClientId('xxxxx CLIENTID xxxxx');
$client->setClientSecret('xxxxx CLIENTSECRET xxxxx');
$client->refreshToken('xxxxx REFRESH TOKEN xxxxx');

// Google Drive Adapter
$googleDrive = new \IF\Flysystem\GoogleDrive\GoogleDriveAdapter(
	new \Google_Service_Drive($client), // Client service
	'root',                             // Folder ID as root ('root' or Folder ID)
	[ 'useHasDir' => true ]             // options (elFinder need hasDir method)
);

// Extended cached strage adapter class for cache enabled of hasDir() method
class myCachedStrageAdapter extends \League\Flysystem\Cached\Storage\Adapter
{
    use \Hypweb\Flysystem\Cached\Extra\Hasdir;
    use \Hypweb\Flysystem\Cached\Extra\DisableEnsureParentDirectories;
}

// Make Flysystem adapter and cache object
$useCache = true;
if ($useCache) {
	// Example to Flysystem cacheing
	$cache = new myCachedStrageAdapter(
		new \League\Flysystem\Adapter\Local('flycache'),
		'gdcache',
		300
	);

	// Flysystem cached adapter
	$adapter = new \League\Flysystem\Cached\CachedAdapter(
		$googleDrive,
		$cache
	);
} else {
	// Not use cached adapter
	$cache = null;
	$adapter = $googleDrive;
}

// Google Drive elFinder Volume driver
$gdrive = [
    // require
    'driver'       => 'FlysystemExt',
    'filesystem'   =>  new \League\Flysystem\Filesystem($adapter),
    'fscache'      => $cache,
    'separator'    => '/',
    // optional
    'alias'        => 'GoogleDrive',
    'rootCssClass' => 'elfinder-navbar-root-googledrive'
];

// elFinder volume roots options
$elFinderOpts = [
	'roots' => []
];

$elFinderOpts['roots'][] = $gdrive;

// run elFinder
$connector = new elFinderConnector(new elFinder($elFinderOpts));
$connector->run();
```

Tips
----

[](#tips)

- [Setup a Laravel Storage driver with Google Drive API](https://gist.github.com/ivanvermeyen/cc7c59c185daad9d4e7cb8c661d7b89b)
- [Issue list with "HowTo" tag](https://github.com/nao-pon/flysystem-google-drive/issues?utf8=%E2%9C%93&q=label%3AHowTo%20)

TODO
----

[](#todo)

- Unit tests to be written

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

Top contributor holds 77.2% 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://avatars.githubusercontent.com/u/36160264?v=4)[Nkoyen Imafidon](/maintainers/feliximafidon)[@feliximafidon](https://github.com/feliximafidon)

---

Top Contributors

[![nao-pon](https://avatars.githubusercontent.com/u/1412630?v=4)](https://github.com/nao-pon "nao-pon (95 commits)")[![feliximafidon](https://avatars.githubusercontent.com/u/36160264?v=4)](https://github.com/feliximafidon "feliximafidon (18 commits)")[![Bilge](https://avatars.githubusercontent.com/u/470626?v=4)](https://github.com/Bilge "Bilge (1 commits)")[![DynamoGeek](https://avatars.githubusercontent.com/u/3771182?v=4)](https://github.com/DynamoGeek "DynamoGeek (1 commits)")[![mrblur](https://avatars.githubusercontent.com/u/842077?v=4)](https://github.com/mrblur "mrblur (1 commits)")[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (1 commits)")[![tobias-kuendig](https://avatars.githubusercontent.com/u/8600029?v=4)](https://github.com/tobias-kuendig "tobias-kuendig (1 commits)")[![tomatow](https://avatars.githubusercontent.com/u/16914394?v=4)](https://github.com/tomatow "tomatow (1 commits)")[![underthecocotree](https://avatars.githubusercontent.com/u/18592003?v=4)](https://github.com/underthecocotree "underthecocotree (1 commits)")[![A34](https://avatars.githubusercontent.com/u/1741817?v=4)](https://github.com/A34 "A34 (1 commits)")[![Unemployed](https://avatars.githubusercontent.com/u/7939211?v=4)](https://github.com/Unemployed "Unemployed (1 commits)")[![benlumley](https://avatars.githubusercontent.com/u/194052?v=4)](https://github.com/benlumley "benlumley (1 commits)")

### Embed Badge

![Health badge](/badges/feliximafidon-flysystem-google-drive/health.svg)

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

PHPackages © 2026

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