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

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

tes/laravel-google-drive-storage
================================

A Laravel package that integrates Google Drive as a storage option, allowing seamless file uploads, folder creation, and file management directly from your Laravel application.

v1.2(7mo ago)82.4k↓48.4%2MITPHPPHP ^8.2

Since Sep 5Pushed 7mo ago2 watchersCompare

[ Source](https://github.com/Thomas-Emad/laravel-google-drive-storage)[ Packagist](https://packagist.org/packages/tes/laravel-google-drive-storage)[ Docs](https://github.com/Thomas-Emad/laravel-google-drive-storage)[ RSS](/packages/tes-laravel-google-drive-storage/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Laravel Google Drive Storage
============================

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

A Laravel package that integrates Google Drive as a storage option, allowing seamless file uploads, folder creation, and file management directly from your Laravel application.

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

[](#installation)

To install this package, you need to include it in your `composer.json` file:

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

```

Configuration
-------------

[](#configuration)

Ensure you have the following environment variables set in your `.env` file:

```
GOOGLE_DRIVE_CLIENT_ID=your_client_id
GOOGLE_DRIVE_CLIENT_SECRET=your_client_secret
GOOGLE_DRIVE_REFRESH_TOKEN=your_refresh_token
GOOGLE_DRIVE_FOLDER_ID=your_folder_id_optional
```

Obtaining a Refresh Token To obtain a refresh token, follow the guide provided in this article: [How to Generate Refresh Token and Use Them to Access Google API](https://medium.com/@amanpal2072004/how-to-generate-refresh-token-and-use-them-to-access-google-api-f7565413c548).

Also you need to add in file `config/filesystems.php` file:

```
'disks' => [
    .........

    'google' => [
      'driver' => 'google',
      'clientId' => env('GOOGLE_DRIVE_CLIENT_ID', ''),
      'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET', ''),
      'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN', ''),
      'folderId'     => env('GOOGLE_DRIVE_FOLDER_ID', ''),
    ]
  ],

```

Usage
-----

[](#usage)

Here are examples of how to use the methods provided by the package.

### `uploadFile`

[](#uploadfile)

Upload a file to Google Drive.

```
use Tes\LaravelGoogleDriveStorage\GoogleDriveService;

$file = $request->file('upload'); // Assuming this comes from a form
$folderId = ''; // Optional

$response = GoogleDriveService::uploadFile($file, $folderId);
echo "File uploaded with ID: " . $response->id;
```

### `createFolder`

[](#createfolder)

Create a new folder in Google Drive.

```
use Tes\LaravelGoogleDriveStorage\GoogleDriveService;

$folderName = 'New Folder';
$response = GoogleDriveService::createFolder($folderName);
echo "Folder created with ID: " . $response['folderId'];
```

### `search`

[](#search)

Search for files or folders in Google Drive by name.

```
use Tes\LaravelGoogleDriveStorage\GoogleDriveService;

$searchName = 'example';
$files = GoogleDriveService::search($searchName, 'all'); // Can be 'files', 'folders', or 'all'

foreach ($files as $file) {
    echo "Found file with ID: " . $file['id'] . " and name: " . $file['name'] . "\n";
}
```

### `listFilesInFolder`

[](#listfilesinfolder)

List files within a specific folder.

```
use Tes\LaravelGoogleDriveStorage\GoogleDriveService;

$folderId = 'your_folder_id';
$files = GoogleDriveService::listFilesInFolder($folderId);

foreach ($files as $file) {
    echo "File in folder with ID: " . $file['id'] . " and name: " . $file['name'] . "\n";
}
```

### `getFileMetadata`

[](#getfilemetadata)

Retrieve metadata of a specific file.

```
use Tes\LaravelGoogleDriveStorage\GoogleDriveService;

$fileId = 'your_file_id';
$metadata = GoogleDriveService::getFileMetadata($fileId);

echo "File metadata:\n";
echo "ID: " . $metadata['id'] . "\n";
echo "Name: " . $metadata['name'] . "\n";
echo "MIME Type: " . $metadata['mimeType'] . "\n";
echo "Size: " . $metadata['size'] . "\n";
echo "Created Time: " . $metadata['createdTime'] . "\n";
echo "Modified Time: " . $metadata['modifiedTime'] . "\n";
```

### `updateFileMetadata`

[](#updatefilemetadata)

Update the metadata (e.g., name) of a specific file.

```
use Tes\LaravelGoogleDriveStorage\GoogleDriveService;

$fileId = 'your_file_id';
$newName = 'Updated File Name';
$response = GoogleDriveService::updateFileMetadata($fileId, $newName);

echo "File updated with ID: " . $response['id'] . " and new name: " . $response['name'];
```

### `download`

[](#download)

Download a file from Google Drive.

```
use Tes\LaravelGoogleDriveStorage\GoogleDriveService;

$path = 'path/to/your/file/on/drive';
$response = GoogleDriveService::download($path); // you got it!!
```

### `url`

[](#url)

Get the URL of a file stored in Google Drive.

```
use Tes\LaravelGoogleDriveStorage\GoogleDriveService;

$path = 'path/to/your/file/on/drive';
$url = GoogleDriveService::url($path);

echo "File URL: " . $url; // Like This Format: https://drive.google.com/file/d/1jGhj2nX2MNbH5VPwe8SqTKSUu0U-S-VX/view?usp=sharing
```

### `delete`

[](#delete)

Delete a file from Google Drive.

```
use Tes\LaravelGoogleDriveStorage\GoogleDriveService;

$path = 'path/to/your/file/on/drive';
$response = GoogleDriveService::delete($path);

if ($response) {
    echo "File deleted successfully.";
} else {
    echo "Failed to delete file.";
}
```

License
-------

[](#license)

This package is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance63

Regular maintenance activity

Popularity29

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.3% 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 ~197 days

Total

3

Last Release

226d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5fd781b0c5e39d4ab6f530d21891e0f24c977b4042fc89f0bb3e1495af9f913?d=identicon)[thomas-emad](/maintainers/thomas-emad)

---

Top Contributors

[![Thomas-Emad](https://avatars.githubusercontent.com/u/54818496?v=4)](https://github.com/Thomas-Emad "Thomas-Emad (18 commits)")[![pablomadariaga](https://avatars.githubusercontent.com/u/69119357?v=4)](https://github.com/pablomadariaga "pablomadariaga (4 commits)")[![thomas-emad-smarttel](https://avatars.githubusercontent.com/u/203507999?v=4)](https://github.com/thomas-emad-smarttel "thomas-emad-smarttel (1 commits)")

---

Tags

phpfilesystemlaravelstoragegoogle-drive

### Embed Badge

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

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

###  Alternatives

[sausin/laravel-ovh

OVH Object Storage driver for laravel

40153.5k](/packages/sausin-laravel-ovh)[zing/laravel-flysystem-obs

Flysystem Adapter for OBS

1211.2k](/packages/zing-laravel-flysystem-obs)

PHPackages © 2026

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