Skip to content

Commit

Permalink
Merge pull request #48 from makeabledk/feat/use-spatie-google-cloud-s…
Browse files Browse the repository at this point in the history
…torage

Use spatie/laravel-google-cloud-storage package instead of superballist
  • Loading branch information
rasmuscnielsen authored Mar 9, 2022
2 parents fda4e2c + 537adec commit 7f7906a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
1 change: 0 additions & 1 deletion .phpunit.result.cache

This file was deleted.

5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"illuminate/container": "^8.80|9.*",
"illuminate/filesystem": "^8.80|9.*",
"illuminate/support": "^8.80|9.*",
"superbalist/laravel-google-cloud-storage": "^2.2",
"spatie/laravel-google-cloud-storage": "^1.0|^2.0",
"guzzlehttp/guzzle": "^7.0"
},
"require-dev": {
Expand All @@ -20,11 +20,10 @@
"intervention/image": "^2.4",
"doctrine/dbal": "^3.0",
"mockery/mockery": "^1.5",
"rutorika/sortable": "8.*",
"rutorika/sortable": "^8.0|^9.0",
"phpunit/phpunit": "9.*"
},
"suggest": {
"illuminate/database": "Required for using extended media library functionality",
"intervention/image": "Intervention image is required to read exif data",
"rutorika/sortable": "Required for using extended media library functionality"
},
Expand Down
12 changes: 10 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ Add a new `gcs` disk to your `filesystems.php` config
'gcs' => [
'driver' => 'gcs',
'project_id' => env('GOOGLE_CLOUD_PROJECT_ID', 'your-project-id'),
'key_file' => env('GOOGLE_CLOUD_KEY_FILE', '/path/to/service-account.json'),
'key_file_path' => env('GOOGLE_CLOUD_KEY_FILE', '/path/to/service-account.json'),
'bucket' => env('GOOGLE_CLOUD_STORAGE_BUCKET', 'your-bucket'),
],
```

See [https://github.com/Superbalist/laravel-google-cloud-storage](https://github.com/Superbalist/laravel-google-cloud-storage) for more details about configuring `filesystems.php`.
See [https://github.com/spatie/laravel-google-cloud-storage](https://github.com/spatie/laravel-google-cloud-storage) for more details about configuring `filesystems.php`.

#### Creating a Google Service Account

Expand All @@ -56,6 +56,14 @@ php artisan migrate
php artisan cloud-images:placeholders
```

### Upgrading from 2.x --> 3.x

Starting with version 3 this package uses `spatie/laravel-google-cloud-storage` instead of `superbalist/laravel-google-cloud-storage`.

- Please ensure you refer to the configuration options in [laravel-google-cloud-storage#installation](https://github.com/spatie/laravel-google-cloud-storage#installation).
- Specifically make sure you change your disk configuration in `config/filesystems.php` @ `gcs.key_file` --> `gcs.key_file_path`.


## Basic usage

### Upload an image
Expand Down
2 changes: 1 addition & 1 deletion src/CloudImagesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Makeable\CloudImages\Console\Commands\Cleanup;
use Makeable\CloudImages\Console\Commands\GeneratePlaceholders;
use Makeable\CloudImages\Contracts\DimensionCalculator;
use Superbalist\LaravelGoogleCloudStorage\GoogleCloudStorageServiceProvider;
use Spatie\GoogleCloudStorage\GoogleCloudStorageServiceProvider;

class CloudImagesServiceProvider extends ServiceProvider
{
Expand Down
10 changes: 0 additions & 10 deletions tests/Feature/DeleteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ public function it_deletes_images()
$this->assertEquals('test.jpg', $deleted->path);
}

/** @test **/
public function it_throws_exception_on_failed_bucket_deletion()
{
$this->expectException(FailedDeletionException::class);

// test.jpg does not exist in storage

CloudImageFacade::delete('test.jpg');
}

/** @test **/
public function it_throws_exception_on_failed_http_request()
{
Expand Down

0 comments on commit 7f7906a

Please sign in to comment.