Download the PHP package pimphand/gdrive without Composer

On this page you can find all versions of the php package pimphand/gdrive. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package gdrive

pimphand/gdrive

Laravel package for using Google Drive as cloud storage with an S3-like API. Supports OAuth2, streaming uploads directly to Drive (without saving to local disk), download/preview with byte-range, and quota sync.

Latest Version on Packagist Total Downloads License

📖 Documentation: English / Indonesia (HTML) — PHP & JavaScript integration guide for new developers.


Features


Requirements


Installation

Via Packagist (production)

Composer resolves and installs the latest stable release automatically (no version constraint needed).

Via path repository (local development)

Add to your Laravel project's composer.json:

Then run:

Publish config (optional)

The config file will be available at config/gdrive.php. Without publishing, the package's default config is merged automatically.

Publish full example app (recommended for first-time setup)

This single command creates controllers, routes, views, and a token store — immediately accessible at /gdrive:

Updating stubs after a package upgrade — vendor:publish does not overwrite existing files. Use one of:

Files created automatically:

File Purpose
routes/gdrive.php /gdrive routes (auto-loaded by the package)
app/Http/Controllers/GDrive/GDriveController.php Dashboard, upload, download, preview, delete
app/Http/Controllers/GDrive/GDriveAuthController.php OAuth connect / callback / disconnect
app/Http/Controllers/GDrive/GDriveApiController.php Chunk upload API + sync
app/Services/GDrive/FileGoogleDriveTokenStore.php Store encrypted tokens in storage/app/gdrive/
resources/views/gdrive/*.blade.php Demo pages
public/js/gdrive-demo.js Direct upload to Drive + sync
public/css/gdrive-drive.css Demo styles
config/gdrive.php Package configuration
gdrive.env.example .env variable template

No need to edit routes/web.php — the package automatically loads routes/gdrive.php if that file exists.

Quick setup (.env only)

  1. Publish the example (see above)
  2. Copy variables from gdrive.env.example to .env:

  3. In Google Cloud Console, add the redirect URI: http://localhost:8000/auth/google/callback
  4. Start the server:

  5. Open http://localhost:8000/gdrive → click Connect Google Drive

Example routes

Method URL Purpose
GET /gdrive Dashboard (quota, file list, upload)
GET /gdrive/connect Start Google OAuth
GET /gdrive/callback OAuth callback
POST /gdrive/disconnect Disconnect Drive
POST /gdrive/upload Upload file
GET /gdrive/files/{id}/download Download file
GET /gdrive/files/{id}/preview Inline preview
DELETE /gdrive/files/{id} Delete file

Google Cloud Configuration

  1. Open Google Cloud Console
  2. Create a project (or use an existing one)
  3. Enable Google Drive API
  4. Create an OAuth 2.0 Client ID (type: Web application)
  5. Add Authorized redirect URIs, for example:
    • http://localhost:8000/auth/google/callback
    • https://yourdomain.com/auth/google/callback

Environment Variables

Add to your Laravel project's .env:


Config validation


Basic Usage

Facade (simplest)

Dependency Injection

Static factory


Upload Controller (full example)


OAuth Flow (example)

The package provides OAuth helpers in GoogleDriveService. Simple route example:


Custom Token Store (multi-account)

For applications with multiple Google Drive accounts, implement GoogleDriveTokenStore:

Use with the service directly:

Or bind globally in AppServiceProvider:


Sync Files from Drive

The package provides reconcile logic:

Artisan sync

Displays quota and the file list in the Drive app folder.


API Reference

GoogleDriveStorage (S3-style)

Method Description Return
put($name, $body, $mime, $size?) Upload to app folder array{id, name, mime_type, size}
get($id, $range?, $disposition?) Stream download/preview StreamedResponse
delete($id) Delete file on Drive void
exists($id) Check if file exists bool
list() List files in app folder array[]
url($id) Google web view URL ?string
quota() Sync & return quota array
drive() Access low-level service GoogleDriveService

GoogleDriveService (low-level)

Method Description
getAuthUrl($state) Generate OAuth authorization URL
exchangeAuthCode($code) Exchange auth code → credentials
ensureAppFolder() Get/create root app folder
upload(...) Upload file
rename($id, $name) Rename on Drive
delete($id) Delete on Drive
getMetadata($id) Fetch file metadata
listAppFolderFiles() List all files in app folder
syncAppFolderFiles($existing) Reconcile with local records
syncQuota() Fetch storage quota from Drive API

TokenCrypto

Method Description
encrypt($value) AES-256-GCM encrypt
decrypt($value) AES-256-GCM decrypt
randomToken($bytes?) Generate random URL-safe token
hashToken($token) SHA-256 hash

Architecture

Important: Virtual folders (file organization in your app) are database metadata only — they are not mirrored in the Google Drive folder structure. All physical files live in a single root pimpdrive folder per Google account.

Publishing to Packagist

  1. Push the package to the GitHub repository pimphand/gdrive
  2. Create a release / semver tag (e.g. v1.0.0)
  3. Submit to Packagist.org
  4. Install in other projects:

Security


License

MIT License — see LICENSE.


Contributing

Pull requests are welcome. For major changes, please open an issue first.


All versions of gdrive with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
google/apiclient Version ^2.18
guzzlehttp/guzzle Version ^7.8
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
symfony/http-foundation Version ^6.4|^7.0|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pimphand/gdrive contains the following files

Loading the files please wait ...