package can't installed in laravel 9
aronei44 opened this issue ยท 14 comments
the problem :
- Root composer.json requires nao-pon/flysystem-google-drive 1.1.0 -> satisfiable by nao-pon/flysystem-google-drive[1.1.0].
- nao-pon/flysystem-google-drive 1.1.0 requires league/flysystem ~1.0 -> found league/flysystem[1.0.0-alpha1, ..., 1.x-dev] but these were not loaded, likely because it conflicts with another require.
I have same issue
i think its not upgraded yet. i'll waiting this great package
Yes I ran into the same problem. This is my exact output:
./composer.json has been updated
Running composer update nao-pon/flysystem-google-drive
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires nao-pon/flysystem-google-drive ~1.1 -> satisfiable by nao-pon/flysystem-google-drive[1.1.0, ..., 1.1.x-dev].
- nao-pon/flysystem-google-drive[1.1.0, ..., 1.1.x-dev] require league/flysystem ~1.0 -> found league/flysystem[1.0.0-alpha1, ..., 1.x-dev] but the package is fixed to 3.0.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
Duplicate of #90
Try this fork for Laravel 9.x flysystem-google-drive-ext (It uses the same config)
Example: laravel-google-drive-ext-demo
Give them a star if it works for you
I finally fixed it using the fork mentioned by @PaolaRuby.
**Make sure your .env
has the necessary google api keys: (Check here if you don't know how!) **
FILESYSTEM_CLOUD=google
GOOGLE_DRIVE_CLIENT_ID=xxx.apps.googleusercontent.com
GOOGLE_DRIVE_CLIENT_SECRET=xxx
GOOGLE_DRIVE_REFRESH_TOKEN=xxx
GOOGLE_DRIVE_FOLDER=my_folder_name
#GOOGLE_DRIVE_TEAM_DRIVE_ID=xxx
Create a service provider class, php artisan make:provider GoogleDriveServiceProvider
, and update your boot()
method as below
public function boot()
{
\Illuminate\Support\Facades\Storage::extend('google', function($app, $config) {
$client = new \Google\Client();
$client->setClientId($config['clientId']);
$client->setClientSecret($config['clientSecret']);
$client->refreshToken($config['refreshToken']);
$service = new \Google\Service\Drive($client);
$options = [];
if(isset($config['teamDriveId'])) {
$options['teamDriveId'] = $config['teamDriveId'];
}
$adapter = new \Masbug\Flysystem\GoogleDriveAdapter($service, $config['folder'] ?? '/', $options);
$driver = new \League\Flysystem\Filesystem($adapter);
return new \Illuminate\Filesystem\FilesystemAdapter($driver, $adapter);
});
}
Include App\Providers\GoogleDriveServiceProvider::class,
inside the providers
array of config/app.php
class.
Go to config/filesystems.php
and add a 'google' driver inside disks arrays, as below:
'google' => [
'driver' => 'google',
'clientId' => env('GOOGLE_DRIVE_CLIENT_ID'),
'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN'),
'folder' => env('GOOGLE_DRIVE_FOLDER'),
// 'teamDriveId' => env('GOOGLE_DRIVE_TEAM_DRIVE_ID'),
],
And then finally inside the routes/web.php
create a test route as below
Route::get('test', function() {
\Illuminate\Support\Facades\Storage::disk('google')->put('test.txt', 'Hello World');
return 'New file was created!';
});
I hope you'll find this helpful. At least this is how I managed to successfully create a test.txt file in my GDRIVE.
Yes, I experience the same problem. Tried what @PaolaRuby recommendation but it needs a lot of changes from my previous implementation. The new version of this repo needs to be updated hopefully!
I receive { "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Login Required", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Login Required" } }
@oriceon your keys are wrong, or maybe your google app is on test mode, so oauth stop working after 7 days, hard to say with almost no information
@douxlagithub this package has no changes since 29 Jul 2020, maybe you can make a fork, and upgrade it: link for upgrade
@besartzeka
Did u get it to work with folderId or folderName?
Duplicate of #90 Try this fork for Laravel 9.x flysystem-google-drive-ext (It uses the same config) Example: laravel-google-drive-ext-demo Give them a star if it works for you
No there are some issue in this package. I got issue on clean backup
I have same issue
@rizkytegar the answer is there, you only have to read
but it needs a lot of changes from my previous implementation. The new version of this repo needs to be updated hopefully!
No changes needed, it's the same, look at nao-pon/flysystem-google-drive
replacement examples
Just add 'useDisplayPaths' => false,
on config array(GoogleDriveServiceProvider.php
)
$options = [
'useDisplayPaths' => false, // just add this
];
if(isset($config['teamDriveId'])) {
$options['teamDriveId'] = $config['teamDriveId'];
}
$adapter = new GoogleDriveAdapter($service, $config['folder'] ?? '/', $options);
$driver = new Filesystem($adapter);
return new FilesystemAdapter($driver, $adapter);