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

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

smadia/laravel-google-drive-connector
=====================================

Connector for Laravel with Google Drive API

0.0.2(8y ago)04.0k[2 issues](https://github.com/Smadia/LaravelGoogleDriveConnector/issues)GNUPHP

Since Oct 29Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Smadia/LaravelGoogleDriveConnector)[ Packagist](https://packagist.org/packages/smadia/laravel-google-drive-connector)[ RSS](/packages/smadia-laravel-google-drive-connector/feed)WikiDiscussions master Synced 3d ago

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

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

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

0.0.2

Installation
============

[](#installation)

Make sure you have already installed laravel &gt;= 5.2.\*

Then, install package via composer

`composer require "smadia/laravel-google-drive-connector:0.0.*"`Register Facade in `config/app.php`

```
'aliases' => [
    .....
    'LGD' => Smadia\LaravelGoogleDrive\Facades\LaravelGoogleDrive::class
    .....
]
```

Register ServiceProvider in `config/app.php`

```
'providers' => [
    .....
    Smadia\LaravelGoogleDrive\Providers\LaravelGoogleDriveServiceProvider::class
    .....
]
```

You can create your own Facade and ServiceProvider manually, and then register it.

Configuration
=============

[](#configuration)

Before using package, make sure you have added new disk in `config/filesystem.php`

```
'disks' => [

    // ...

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

    // ...

],
```

Then, you should add new field in `.env` files

```
FILESYSTEM_CLOUD=googledrive
GOOGLE_DRIVE_CLIENT_ID=xxx.apps.googleusercontent.com
GOOGLE_DRIVE_CLIENT_SECRET=xxx
GOOGLE_DRIVE_REFRESH_TOKEN=xxx
GOOGLE_DRIVE_FOLDER_ID=null
```

How do I get the Google Drive API ? Follow these links :

- [Getting your Client ID and Secret](https://github.com/ivanvermeyen/laravel-google-drive-demo/blob/master/README/1-getting-your-dlient-id-and-secret.md)
- [Getting your Refresh Token](https://github.com/ivanvermeyen/laravel-google-drive-demo/blob/master/README/2-getting-your-refresh-token.md)
- [Getting your Root Folder ID](https://github.com/ivanvermeyen/laravel-google-drive-demo/blob/master/README/3-getting-your-root-folder-id.md)

Usage
-----

[](#usage)

### Usage in non-object file

[](#usage-in-non-object-file)

You can use LGD Facade in non-object file, such as routes/web.php, blade file. Below is the example usage in non-object file

```
LGD::dir('mydir')->ls()->toObject();
```

If you are using the Facade in object context, you should use the Facade in `Smadia\LaravelGoogleDrive\Facades\LaravelGoogleDrive` after the `namespace` declaration like below

```
