diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/pint.yml similarity index 58% rename from .github/workflows/php-cs-fixer.yml rename to .github/workflows/pint.yml index fbec801bb..975ad1728 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/pint.yml @@ -12,12 +12,10 @@ jobs: with: ref: ${{ github.head_ref }} - - name: Run PHP CS Fixer - uses: docker://oskarstark/php-cs-fixer-ga - with: - args: --config=.php_cs.dist.php --allow-risky=yes + - name: Fix styling issues + uses: aglipanci/laravel-pint-action@0.1.0 - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v5 + uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: Fix styling diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index cb8d5b596..0a11caff4 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,17 +8,12 @@ jobs: strategy: fail-fast: false matrix: - php: [8.3, 8.2, 8.1, 8.0] - laravel: [10.*, 9.*] + php: [8.3, 8.2] + laravel: [10.*] dependency-version: [prefer-lowest, prefer-stable] include: - laravel: 10.* testbench: ^8.0 - - laravel: 9.* - testbench: ^7.0 - exclude: - - laravel: 10.* - php: 8.0 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} diff --git a/.php_cs.dist.php b/.php_cs.dist.php deleted file mode 100644 index ea229dfc5..000000000 --- a/.php_cs.dist.php +++ /dev/null @@ -1,35 +0,0 @@ -in([ - __DIR__ . '/src', - __DIR__ . '/tests', - ]) - ->name('*.php') - ->notName('*.blade.php') - ->ignoreDotFiles(true) - ->ignoreVCS(true); - -return (new PhpCsFixer\Config()) - ->setRules([ - '@PSR12' => true, - 'array_syntax' => ['syntax' => 'short'], - 'ordered_imports' => ['sort_algorithm' => 'alpha'], - 'no_unused_imports' => true, - 'not_operator_with_successor_space' => true, - 'trailing_comma_in_multiline' => true, - 'phpdoc_scalar' => true, - 'unary_operator_spaces' => true, - 'binary_operator_spaces' => true, - 'blank_line_before_statement' => [ - 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], - ], - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_var_without_name' => true, - 'method_argument_space' => [ - 'on_multiline' => 'ensure_fully_multiline', - 'keep_multiple_spaces_after_comma' => true, - ], - 'single_trait_insert_per_statement' => true, - ]) - ->setFinder($finder); diff --git a/README.md b/README.md index 42ca00c3c..1032cb817 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # Associate files with Eloquent models [](https://github.com/spatie/laravel-medialibrary/releases) - +[](https://github.com/spatie/laravel-medialibrary/actions/workflows/run-tests.yml) [](https://packagist.org/packages/spatie/laravel-medialibrary) This package can associate all sorts of files with Eloquent models. It provides a @@ -30,7 +30,7 @@ $newsItem->addMedia($bigFile)->toMediaCollection('downloads', 's3'); ``` The storage of the files is handled by [Laravel's Filesystem](https://laravel.com/docs/filesystem), -so you can use any filesystem you like. Additionally the package can create image manipulations +so you can use any filesystem you like. Additionally, the package can create image manipulations on images and pdfs that have been added in the media library. Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource). diff --git a/UPGRADING.md b/UPGRADING.md index a63b41dbf..6e62f08ce 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -2,6 +2,12 @@ Because there are many breaking changes an upgrade is not that easy. There are many edge cases this guide does not cover. We accept PRs to improve this guide. +## From v10 to v11 + +- Image v3 is now used. Make sure to update your image conversions to the new syntax. See [the image docs](https://spatie.be/docs/image/v3) for more info. +- All event names have gained the `Event` suffix. For example `Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAdded` is now `Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAddedEvent`. + + ## From v9 to v10 Upgrading from v9 to v10 is straightforward. The biggest change is that we dropped support for PHP 7, and are using PHP 8 features. diff --git a/composer.json b/composer.json index 7a381ff4f..cba50e5d2 100644 --- a/composer.json +++ b/composer.json @@ -22,37 +22,38 @@ ], "homepage": "https://github.com/spatie/laravel-medialibrary", "require": { - "php": "^8.0", + "php": "^8.2", "ext-exif": "*", "ext-fileinfo": "*", "ext-json": "*", - "illuminate/bus": "^9.18|^10.0", - "illuminate/conditionable": "^9.18|^10.0", - "illuminate/console": "^9.18|^10.0", - "illuminate/database": "^9.18|^10.0", - "illuminate/pipeline": "^9.18|^10.0", - "illuminate/support": "^9.18|^10.0", - "maennchen/zipstream-php": "^2.0|^3.0", - "spatie/image": "^2.2.7", - "spatie/temporary-directory": "^2.0", - "symfony/console": "^6.0" + "illuminate/bus": "^10.0", + "illuminate/conditionable": "^10.0", + "illuminate/console": "^10.0", + "illuminate/database": "^10.0", + "illuminate/pipeline": "^10.0", + "illuminate/support": "^10.0", + "maennchen/zipstream-php": "^3.1", + "spatie/image": "^3.0", + "spatie/laravel-package-tools": "^1.16.1", + "spatie/temporary-directory": "^2.2", + "symfony/console": "^6.4.1|^7.0" }, "require-dev": { "ext-imagick": "*", "ext-pdo_sqlite": "*", "ext-zip": "*", - "aws/aws-sdk-php": "^3.133.11", - "doctrine/dbal": "^2.13", - "guzzlehttp/guzzle": "^7.4", - "league/flysystem-aws-s3-v3": "^3.0", - "mockery/mockery": "^1.4", - "nunomaduro/larastan": "^2.0", - "orchestra/testbench": "^7.0|^8.0", - "pestphp/pest": "^1.21", - "phpstan/extension-installer": "^1.1", - "spatie/laravel-ray": "^1.28", - "spatie/pdf-to-image": "^2.1", - "spatie/phpunit-snapshot-assertions": "^4.2" + "aws/aws-sdk-php": "^3.293.10", + "doctrine/dbal": "^2.13.9", + "guzzlehttp/guzzle": "^7.8.1", + "league/flysystem-aws-s3-v3": "^3.22", + "mockery/mockery": "^1.6.7", + "larastan/larastan": "^2.7", + "orchestra/testbench": "^7.0|^8.17", + "pestphp/pest": "^2.28", + "phpstan/extension-installer": "^1.3.1", + "spatie/laravel-ray": "^1.33", + "spatie/pdf-to-image": "^2.2", + "spatie/pest-plugin-snapshots": "^2.1" }, "conflict": { "php-ffmpeg/php-ffmpeg": "<0.6.1" @@ -91,7 +92,6 @@ "scripts": { "analyse": "vendor/bin/phpstan analyse", "baseline": "vendor/bin/phpstan analyse --generate-baseline", - "format": "vendor/bin/php-cs-fixer fix --allow-risky=yes", "test": "vendor/bin/pest" } } diff --git a/config/media-library.php b/config/media-library.php index a5fc86764..e369db782 100644 --- a/config/media-library.php +++ b/config/media-library.php @@ -39,7 +39,7 @@ /* * When enabled, media collections will be serialised using the default * laravel model serialization behaviour. - * + * * Keep this option disabled if using Media Library Pro components (https://medialibrary.pro) */ 'use_default_collection_serialization' => false, diff --git a/docs/_index.md b/docs/_index.md index 7362a6936..edc1d983b 100644 --- a/docs/_index.md +++ b/docs/_index.md @@ -1,5 +1,5 @@ --- -title: v10 +title: v11 slogan: Associate files with Eloquent models. githubUrl: https://github.com/spatie/laravel-medialibrary branch: main diff --git a/docs/advanced-usage/consuming-events.md b/docs/advanced-usage/consuming-events.md index 5567a512a..93e552279 100644 --- a/docs/advanced-usage/consuming-events.md +++ b/docs/advanced-usage/consuming-events.md @@ -5,12 +5,12 @@ weight: 8 The media library will fire the following events that your handlers can listen for: -### MediaHasBeenAdded +### MediaHasBeenAddedEvent This event is fired after a file has been saved to disk. The event has a property `media` that holds the `\Spatie\MediaLibrary\Models\Media`-object of which the file has been stored. -### ConversionWillStart +### ConversionWillStartEvent This event is fired right before a conversion will start. The event has two public properties: @@ -18,7 +18,7 @@ The event has two public properties: - `media`: the `\Spatie\MediaLibrary\Models\Media`-object of which a conversion will be started - `conversion`: the conversion (an instance of `\Spatie\MediaLibrary\Conversion\Conversion`) that will start -### ConversionHasBeenCompleted +### ConversionHasBeenCompletedEvent This event is fired when a conversion has been completed. The event has two public properties: @@ -26,7 +26,7 @@ The event has two public properties: - `media`: the `\Spatie\MediaLibrary\Models\Media`-object of which a conversion has been completed - `conversion`: the conversion (an instance of `\Spatie\MediaLibrary\Conversion\Conversion`) that has just been completed -### CollectionHasBeenCleared +### CollectionHasBeenClearedEvent This event will be fired after a collection has been cleared. The event has two public properties: @@ -42,11 +42,11 @@ First you must create a listener class. Here's one that will log the paths of ad namespace App\Listeners; use Log; -use Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAdded; +use Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAddedEvent; class MediaLogger { - public function handle(MediaHasBeenAdded $event) + public function handle(MediaHasBeenAddedEvent $event) { $media = $event->media; $path = $media->getPath(); @@ -59,8 +59,8 @@ Hook it up in `app/Providers/EventServiceProvider.php` to let Laravel know that ```php protected $listen = [ - 'Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAdded' => [ - 'App\Listeners\MediaLogger' + Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAddedEvent::class => [ + App\Listeners\MediaLogger::class ], ]; ``` diff --git a/docs/handling-uploads-with-media-library-pro/handling-uploads-with-livewire-2.md b/docs/handling-uploads-with-media-library-pro/handling-uploads-with-livewire-2.md index dcbe63ddc..e1f6271a6 100644 --- a/docs/handling-uploads-with-media-library-pro/handling-uploads-with-livewire-2.md +++ b/docs/handling-uploads-with-media-library-pro/handling-uploads-with-livewire-2.md @@ -317,7 +317,7 @@ blade view that will be used to display all form elements on a row in the compon In this example we're going to add a custom property form field called `extra_field`. ```html -@include('media-library::livewire.partials.collection.fields') +@include('medialibrary::livewire.partials.collection.fields')