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

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

fnsc/laravel-google-drive
=========================

Filesystem adapter for Google Drive

1.3.0(3mo ago)82201[1 issues](https://github.com/fnsc/laravel-google-drive/issues)[1 PRs](https://github.com/fnsc/laravel-google-drive/pulls)MITPHPPHP ^8.2CI passing

Since Dec 27Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/fnsc/laravel-google-drive)[ Packagist](https://packagist.org/packages/fnsc/laravel-google-drive)[ RSS](/packages/fnsc-laravel-google-drive/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (4)Dependencies (11)Versions (8)Used By (0)

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

[](#laravel-google-drive)

 [![](https://camo.githubusercontent.com/431069d2d7866314718b5478b7600b8e89d53f7615c38f72c9f50b4d6053bb55/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f666e73632f6c61726176656c2d676f6f676c652d6472697665)](https://github.com/fnsc/laravel-google-drive/graphs/contributors) [![Tests Status](https://github.com/fnsc/laravel-google-drive/workflows/Tests/badge.svg)](https://github.com/fnsc/laravel-google-drive/actions?query=workflow%3ATests) [![](https://camo.githubusercontent.com/978798daf5b25786cb2534c8c2b9084300a55de0e12655eb08e2463ddb944fb1/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6130643031343664653766653432313239356539396130633039623964623863)](https://www.codacy.com/gh/fnsc/laravel-google-drive/dashboard) [![](https://camo.githubusercontent.com/c5c3096bd02d45f29d447554043ae3d587d851caadff8cf87669b28fb938f077/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f436f7665726167652f6130643031343664653766653432313239356539396130633039623964623863)](https://www.codacy.com/gh/fnsc/laravel-google-drive/dashboard)

A Laravel package to upload, download, and delete files on Google Drive using a service account.

- [Requirements](#requirements)
- [Installation](#installation)
- [Setup](#setup)
- [Usage](#usage)
- [License](#license)

Requirements
------------

[](#requirements)

- PHP ^8.2
- Laravel ^10.0

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

[](#installation)

```
composer require fnsc/laravel-google-drive
```

Publish the config file:

```
php artisan vendor:publish --provider="LaravelGoogleDrive\ServiceProvider"
```

Setup
-----

[](#setup)

### 1. Create a Google Service Account

[](#1-create-a-google-service-account)

Go to [Google Cloud Console → Credentials](https://console.cloud.google.com/apis/credentials), create a Service Account, and download the generated JSON key file.

Add the file to your project (e.g. `storage/app/service-account.json`) and **never commit it to git**.

### 2. Share the Google Drive folder

[](#2-share-the-google-drive-folder)

Open the target folder in Google Drive, click **Share**, and add the `client_email`from the JSON file with **Editor** access.

### 3. Configure environment variables

[](#3-configure-environment-variables)

Add the following to your `.env` file:

```
GOOGLE_APPLICATION_CREDENTIALS=storage/app/service-account.json
GOOGLE_DRIVE_FOLDER_ID=your_folder_id_here
```

`GOOGLE_APPLICATION_CREDENTIALS` is the path to the JSON key file relative to the project root. `GOOGLE_DRIVE_FOLDER_ID` is the ID found in the Google Drive folder URL: `https://drive.google.com/drive/folders/`.

Usage
-----

[](#usage)

Inject `LaravelGoogleDrive\GoogleDrive` into your controller or route closure.

### Upload a file

[](#upload-a-file)

```
use LaravelGoogleDrive\GoogleDrive;
use Illuminate\Http\Request;

Route::post('/upload', function (Request $request, GoogleDrive $drive) {
    $result = $drive->upload($request->file('file'));

    return [
        'file_id'   => $result->getFileId(),
        'file_name' => $result->getFileName(),
        'folder_id' => $result->getFolderId(),
    ];
});
```

To upload to a specific folder instead of the default one, pass the folder ID as the second argument:

```
$drive->upload($request->file('file'), 'your_folder_id');
```

### Upload multiple files

[](#upload-multiple-files)

```
$results = $drive->uploadMany($request->file('files'));
```

### Download a file

[](#download-a-file)

```
use Illuminate\Http\Response;

Route::get('/download', function (GoogleDrive $drive) {
    $file = $drive->get('filename.pdf', 'google_drive_file_id');

    return new Response($file->getContent(), 200, [
        'Content-Type'        => $file->getMimeType(),
        'Content-Disposition' => 'attachment; filename=' . $file->getName(),
    ]);
});
```

### Delete a file

[](#delete-a-file)

```
$deleted = $drive->delete('google_drive_file_id'); // returns bool
```

License
-------

[](#license)

This package is free software distributed under the terms of the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance78

Regular maintenance activity

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~390 days

Total

4

Last Release

106d ago

PHP version history (2 changes)1.0.0PHP ^8.1

1.3.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23709089?v=4)[Gabriel Fonseca](/maintainers/fnsc)[@fnsc](https://github.com/fnsc)

---

Top Contributors

[![fnsc](https://avatars.githubusercontent.com/u/23709089?v=4)](https://github.com/fnsc "fnsc (48 commits)")

---

Tags

drivegooglegoogle-drivelaraveluploadupload-file

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[propaganistas/laravel-disposable-email

Disposable email validator

6012.9M7](/packages/propaganistas-laravel-disposable-email)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

9782.1M162](/packages/laravel-ai)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

721160.4k12](/packages/tallstackui-tallstackui)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k55.1k1](/packages/mike-bronner-laravel-model-caching)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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