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

ActiveLibrary

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

Filesystem adapter for Google Drive

1.3.0(2mo ago)72111[2 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 2mo 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 1mo 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

47

—

FairBetter than 94% of packages

Maintenance82

Actively maintained with recent releases

Popularity20

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

60d ago

PHP version history (2 changes)1.0.0PHP ^8.1

1.3.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c084492162bdce31f17be7db61373f3f823d9180cc93bb221c84c4b6ee544bd?d=identicon)[fnsc](/maintainers/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

[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[genealabs/laravel-model-caching

Automatic caching for Eloquent models.

2.4k4.8M26](/packages/genealabs-laravel-model-caching)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[mikebronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k127.1k1](/packages/mikebronner-laravel-model-caching)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)

PHPackages © 2026

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