klytron/laravel-google-drive-filesystem
Composer 安装命令:
composer require klytron/laravel-google-drive-filesystem
包简介
Google Drive filesystem adapter for Laravel (10, 11, 12, 13)
README 文档
README
A robust Google Drive filesystem adapter for Laravel that provides seamless integration with Google Drive as a storage disk. Features configurable debug logging, automatic folder creation, and full Laravel Filesystem API compatibility.
✨ Features
- 🚀 Full Laravel Filesystem API Support - Use Google Drive like any other Laravel disk
- 🔧 Configurable Debug Logging - Control debug output in production environments
- 📁 Automatic Folder Creation - Folders are created automatically when needed
- 🔐 Secure Authentication - Support for both access tokens and refresh tokens
- 📊 Metadata Support - File sizes, modification times, and MIME types
- 🛡️ Production Ready - Proper error handling and logging configuration
- 📚 Comprehensive Documentation - Detailed setup and usage guides
📋 Requirements
- PHP 8.1 or higher
- Laravel 10.x, 11.x, or 12.x
- Google Cloud Platform project with Drive API enabled
🚀 Quick Installation
Install via Composer:
composer require klytron/laravel-google-drive-filesystem
For advanced installation and VCS/development setup, see docs/INSTALLATION.md.
⚙️ Quick Configuration
Publish the config file and set up your .env:
php artisan vendor:publish --tag=google-drive-config
Add your Google Drive credentials to your .env file. For a detailed step-by-step guide, see docs/GETTING-TOKENS.md.
🔑 Environment Variables
# Google Drive API Credentials GOOGLE_DRIVE_CLIENT_ID=your-client-id GOOGLE_DRIVE_CLIENT_SECRET=your-client-secret GOOGLE_DRIVE_ACCESS_TOKEN=your-access-token GOOGLE_DRIVE_REFRESH_TOKEN=your-refresh-token GOOGLE_DRIVE_FOLDER_ID=your-folder-id # Debug Logging (optional) GOOGLE_DRIVE_DEBUG=false GOOGLE_DRIVE_LOG_PAYLOAD=false
Debug Logging Options
The debug logging options default to APP_DEBUG but can be overridden:
GOOGLE_DRIVE_DEBUG: Enable detailed debug logging for operations (defaults toAPP_DEBUG)GOOGLE_DRIVE_LOG_PAYLOAD: Enable logging of HTTP payloads and detailed operation info (defaults toAPP_DEBUG)
Production Tip: Set both debug options to
falsein production to prevent unnecessary log output.
📖 Usage
After configuring, you can use the Google Drive disk in your Laravel application like this:
use Illuminate\Support\Facades\Storage; // Store a file Storage::disk('google')->put('example.txt', 'Hello, Google Drive!'); // Retrieve a file $content = Storage::disk('google')->get('example.txt'); // List files in a directory $files = Storage::disk('google')->files('/'); // Delete a file Storage::disk('google')->delete('example.txt'); // Check if file exists if (Storage::disk('google')->exists('example.txt')) { // File exists } // Get file size $size = Storage::disk('google')->size('example.txt'); // Get last modified time $modified = Storage::disk('google')->lastModified('example.txt');
🗂️ Working with Folders
// Create a directory (folders are created automatically when uploading files) Storage::disk('google')->makeDirectory('uploads/images'); // List directories $directories = Storage::disk('google')->directories('/'); // List all contents (files and folders) $contents = Storage::disk('google')->allFiles('/'); // Delete a directory and all its contents Storage::disk('google')->deleteDirectory('uploads/images');
For advanced usage and more examples, see docs/USAGE.md.
🔧 Laravel Compatibility
- Laravel: 10.x, 11.x, 12.x, 13.x
- PHP: 8.1 or higher
- Google API Client: ^2.15
- Flysystem: ^3.0
📝 License
The MIT License (MIT). Please see License File for more information.
🔗 Links
- Author: Michael K. Laweh
- GitHub: klytron
- Packagist: klytron/laravel-google-drive-filesystem
- Issues: GitHub Issues
- Funding: Buy me a coffee
📚 Documentation
klytron/laravel-google-drive-filesystem 适用场景与选型建议
klytron/laravel-google-drive-filesystem 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 838 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 08 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「filesystem」 「storage」 「laravel」 「google-drive」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 klytron/laravel-google-drive-filesystem 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 klytron/laravel-google-drive-filesystem 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 klytron/laravel-google-drive-filesystem 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A SDK for working with B2 cloud storage.
A PHP class providing static methods for reading, writing, copying, moving, and deleting files and directories, MIME type detection, image size detection, and file permission management
Small library to access Microsoft Windows Azure Blob Storage with a Service or a StreamWrapper.
The flysystem adapter for yandex disk rest api.
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
phpABLE file-system library
统计信息
- 总下载量: 838
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-17