laravel-google-drive-connector maintained by smadia
Laravel Google Drive Connector
0.0.2
Installation
Make sure you have already installed laravel >= 5.2.*
Then, install package via composer
Register Facade in config/app.php
Register ServiceProvider in config/app.php
You can create your own Facade and ServiceProvider manually, and then register it.
Configuration
Before using package, make sure you have added new disk in config/filesystem.php
Then, you should add new field in .env files
How do I get the Google Drive API ? Follow these links :
Usage
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
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
After that, you can use LaravelGoogleDrive facade instead than LGD like below
To use it only with LGD keyword, you can use as in use declaration like code below
Get list contents from your root directory
Get the spesific directory
Get the spesific index if you have two or more with the same name
Index is started from 0 (zero)
Get the spesific file in certain directory
You can add index to get the file (if you have two or more files with the same name)
Get other file's properties
Below is the list of file's property which you can get by adding ->(property) after file() method
- name
- extension
- path
- dirname
- basename
- size
- timestamp
- mimetype (only for file type)
- type
Filter
To filter the list contents of directory, you can use filter() method
File Storing
These are some example to store file in Google Drive
If you want store the uploaded file in your controller, you can use this one
If you want the name is same with the orginal uploaded file, you can assign the $request->file() as parameter
Directory methods
Below is optional method to your directory