Download the PHP package masbug/flysystem-google-drive-ext without Composer
On this page you can find all versions of the php package masbug/flysystem-google-drive-ext. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download masbug/flysystem-google-drive-ext
More information about masbug/flysystem-google-drive-ext
Files in masbug/flysystem-google-drive-ext
Package flysystem-google-drive-ext
Short Description Flysystem adapter for Google Drive with seamless virtual<=>display path translation
License Apache-2.0
Informations about the package flysystem-google-drive-ext
Flysystem adapter for Google Drive with seamless virtual<=>display path translation
Google uses unique IDs for each folder and file. This makes it difficult to integrate with other storage services which use normal paths.
This Flysystem adapter works around that problem by seamlessly translating paths from "display paths" to "virtual paths", and vice versa.
For example: virtual path /Xa3X9GlR6EmbnY1RLVTk5VUtOVkk/0B3X9GlR6EmbnY1RLVTk5VUtOVkk
becomes /My Nice Dir/myFile.ext
and all ID handling is hidden.
Installation
-
For Flysystem V2/V3 or Laravel >= 9.x.x
- For Flysystem V1 or Laravel <= 8.x.x use 1.x.x version of the package
Getting Google Keys
Please follow Google Docs to obtain your client ID, client secret & refresh token
.
In addition you can also check these easy-to-follow tutorial by @ivanvermeyen
Usage
File upload
File download
How to get TeamDrive list and IDs
How permanently deletes all of the user's trashed files
Using with Laravel Framework
Update .env
file with google keys
Add the keys you created to your .env
file and set google
as your default cloud storage. You can copy the .env.example
file and fill in the blanks.
Add disks on config/filesystems.php
Add driver storage in a ServiceProvider
on path app/Providers/
Example:
Now you can access the drives like so:
Keep in mind that there can only be one default cloud storage drive, defined by FILESYSTEM_CLOUD
in your .env
(or config) file. If you set it to google
, that will be the cloud drive:
Limitations
Using display paths as identifiers for folders and files requires them to be unique. Unfortunately Google Drive allows users to create files and folders with same (displayed) names. In such cases when unique path cannot be determined this adapter chooses the oldest (first) instance. In case the newer duplicate is a folder and user puts a unique file or folder inside the adapter will be able to reach it properly (because full path is unique).
Concurrent use of same Google Drive might lead to unexpected problems due to heavy caching of file/folder identifiers and file objects.
Acknowledgements
This adapter is based on wonderful flysystem-google-drive by Naoki Sawada.
It also contains an adaptation of Google_Http_MediaFileUpload by Google. I've added support for resumable uploads directly from streams (avoiding copying data to memory).
TeamDrive support was implemented by Maximilian Ruta - Deltachaos.
Adapter rewrite for Flysystem V2 and various fixes were implemented by Erik Niebla - erikn69.
All versions of flysystem-google-drive-ext with dependencies
ext-mbstring Version *
guzzlehttp/guzzle Version ^6.3 | ^7.0
league/flysystem Version ^2.1.1|^3.0
google/apiclient Version ^2.2
guzzlehttp/psr7 Version ^1.7|^2.0