gestione documentale avanzata 1 parte

This commit is contained in:
2026-05-28 09:34:28 +02:00
parent 3471befb1a
commit f2b0833b90
34482 changed files with 4312269 additions and 546 deletions
+33
View File
@@ -0,0 +1,33 @@
{
"name": "as247/flysystem-google-drive",
"description": "Google Drive Adapter for Flysystem",
"keywords": ["php", "storage", "drive","google","google-drive"],
"homepage": "https://github.com/as247",
"license": "MIT",
"authors": [
{
"name": "As247",
"email": "as247@vui360.com",
"homepage": "http://as247.vui360.com"
}
],
"require": {
"php": ">=7.1",
"ext-json": "*",
"as247/cloud-storages": "^1.2.4",
"league/flysystem": "^3.23",
"google/apiclient": "^2.0"
},
"autoload": {
"psr-4": {
"As247\\Flysystem\\GoogleDrive\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"As247\\Flysystem\\GoogleDrive\\Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
+38
View File
@@ -0,0 +1,38 @@
# Flysystem Adapter for Google Drive
[![Author](https://img.shields.io/badge/author-as247-orange)](http://as247.vui360.com/)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
## Installation
```bash
composer require as247/flysystem-google-drive
```
## Usage
#### Follow [Google Docs](https://developers.google.com/drive/v3/web/enable-sdk) to obtain your `ClientId, ClientSecret & refreshToken`
#### In addition, you can also check these easy-to-follow tutorial by [@ivanvermeyen](https://github.com/ivanvermeyen/laravel-google-drive-demo)
- [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)
```php
$client = new \Google_Client();
$client->setClientId('[app client id].apps.googleusercontent.com');
$client->setClientSecret('[app client secret]');
$client->fetchAccessTokenWithRefreshToken('[your refresh token]');
$service = new \Google_Service_Drive($client);
$options=[
'root'=>'[Root folder id]',
'teamDrive'=>'[Team drive id]'//If your root folder inside team drive
'google_drive_adapter_prefix'=>'[Path prefix]',//Path prefix inside root folder
];
$adapter = new \As247\Flysystem\GoogleDrive\GoogleDriveAdapter($service, $options);
$filesystem = new \League\Flysystem\Filesystem($adapter);
```
@@ -0,0 +1,29 @@
<?php
/**
* Created by PhpStorm.
* User: alt
* Date: 04-Oct-18
* Time: 10:46 PM
*/
namespace As247\Flysystem\GoogleDrive;
use As247\CloudStorages\Storage\GoogleDrive;
use As247\CloudStorages\Support\StorageToAdapter;
use Google_Service_Drive;
use League\Flysystem\FilesystemAdapter;
use League\Flysystem\PathPrefixer;
class GoogleDriveAdapter implements FilesystemAdapter
{
use StorageToAdapter;
protected $prefixer;
public function __construct(Google_Service_Drive $service, $options = [])
{
if(!is_array($options)){
$options=['root'=>$options];
}
$this->storage = new GoogleDrive($service,$options);
$this->prefixer = new PathPrefixer($options['google_drive_adapter_prefix']??'', DIRECTORY_SEPARATOR);
}
}