Skip to content

Commit

Permalink
Adding PHP 8 support (#25)
Browse files Browse the repository at this point in the history
* Added PHP 8 support
* Removed Scrutinizer analysis
* Updated PHPCS checker and fixer norm to PSR-12
  • Loading branch information
Okipa authored Nov 14, 2020
1 parent fbb1b4f commit 3c5d3aa
Show file tree
Hide file tree
Showing 19 changed files with 221 additions and 251 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: ['7.4']
php: ['7.4', '8.0']
laravel: ['7.*', '8.*']
include:
- laravel: '8.*'
Expand All @@ -38,21 +38,21 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: common, curl, json, mbstring, zip, sqlite, pdo_sqlite
extensions: curl, json, mbstring, zip, sqlite, pdo_sqlite
coverage: xdebug

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --prefer-dist --no-interaction --no-suggest
composer update --prefer-dist --no-interaction
# lower php and laravel versions
# Lower php and laravel versions.

- name: PHPUnit
if: matrix.php != '7.4' || matrix.laravel != '8.*'
run: vendor/bin/phpunit

# last php and laravel versions
# Last php and laravel versions.

- name: Code analysis
if: matrix.php == '7.4' && matrix.laravel == '8.*'
Expand Down
28 changes: 0 additions & 28 deletions .scrutinizer.yml

This file was deleted.

122 changes: 65 additions & 57 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,201 +1,209 @@
# Changelog

## [9.1.0](https://github.com/Okipa/laravel-medialibrary-ext/compare/8.1.0...Okipa:9.0.0)

2020-11-14

* Added PHP 8 support
* Removed Scrutinizer analysis
* Updated PHPCS checker and fixer norm to PSR-12

## [9.0.0](https://github.com/Okipa/laravel-medialibrary-ext/compare/8.1.0...9.0.0)

2020-10-30

* Followed spatie/media-library upgrade to v9.
* Upgraded spatie/laravel-medialibrary required version to 9

## [8.1.0](https://github.com/Okipa/laravel-medialibrary-ext/compare/8.0.0...8.1.0)

2020-09-09

* Added Laravel 8 support.
* Dropped Laravel 6 support.
* Added Laravel 8 support
* Dropped Laravel 6 support

## [8.0.1](https://github.com/Okipa/laravel-medialibrary-ext/compare/8.0.0...8.0.1)

2020-09-03

* Fixed bytes conversions in kilobytes and megabytes.
* Fixed bytes conversions in kilobytes and megabytes

## [8.0.0](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.19.2...8.0.0)

2020-03-30

* Followed spatie/media-library upgrade to v8.
* Removed fork link from spatie/laravel-medialibrary repository.
* Pulled out the extension from the original package. The extension does now live separately.
* Removed configuration use.
* Removed deprecated methods.
* Renamed methods.
* Removed translation files.
* Followed spatie/media-library upgrade to v8
* Removed fork link from spatie/laravel-medialibrary repository
* Pulled out the extension from the original package. The extension does now live separately
* Removed configuration use
* Removed deprecated methods
* Renamed methods
* Removed translation files

:point_right: [See the upgrade guide](/docs/upgrade-guides/from-v7-to-v8.md)

## [7.19.2](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.19.1...7.19.2)

2020-03-30

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.19.3 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.19.3 release

## [7.19.1](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.19.0...7.19.1)

2020-03-06

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.19.2 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.19.2 release

## [7.19.0](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.18.0...7.19.0)

2020-03-03

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.19.0 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.19.0 release

## [7.18.0](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.17.3...7.18.0)

2020-03-02

* Refactored the translations, you should update them if you use custom translations.
* Deprecated the `constraintsLegend` method. Use `constraintsCaption` instead.
* Deprecated the `dimensionsLegend` method. Use `dimensionsCaption` instead.
* Deprecated the `mimeTypesLegend`method . Use `mimeTypesCaption` instead.
* Deprecated the `mimeTypesValidationConstraints`method. Use `mimeTypesValidationRules` instead.
* Deprecated the `mimesValidationConstraints`method. Use `mimesValidationRules` instead.
* Deprecated the `dimensionValidationConstraints`method. Use `dimensionValidationRules` instead.
* Added a `->sizeCaption()` method to generate the config max file size constraint caption.
* The max file size caption is now returned by the `->constraintsCaption()` method with the other constraint captions.
* Added a `->sizeValidationRule()` method to generate the the config max file size validation rule.
* The max file size validation rule is now returned by the `->validationRules()` method with the other validation rules.
* Refactored the translations, you should update them if you use custom translations
* Deprecated the `constraintsLegend` method. Use `constraintsCaption` instead
* Deprecated the `dimensionsLegend` method. Use `dimensionsCaption` instead
* Deprecated the `mimeTypesLegend`method . Use `mimeTypesCaption` instead
* Deprecated the `mimeTypesValidationConstraints`method. Use `mimeTypesValidationRules` instead
* Deprecated the `mimesValidationConstraints`method. Use `mimesValidationRules` instead
* Deprecated the `dimensionValidationConstraints`method. Use `dimensionValidationRules` instead
* Added a `->sizeCaption()` method to generate the config max file size constraint caption
* The max file size caption is now returned by the `->constraintsCaption()` method with the other constraint captions
* Added a `->sizeValidationRule()` method to generate the the config max file size validation rule
* The max file size validation rule is now returned by the `->validationRules()` method with the other validation rules

## [7.17.3](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.17.2...Okipa:7.17.3)

2020-02-19

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.18.3 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.18.3 release

## [7.17.2](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.17.1...Okipa:7.17.2)

2020-02-14

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.18.2 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.18.2 release

## [7.17.1](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.17.0...Okipa:7.17.1)

2020-01-22

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.18.1 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.18.1 release

## [7.17.0](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.16.0...Okipa:7.17.0)

2020-01-06

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.18.0 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.18.0 release

## [7.16.0](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.15.1...Okipa:7.16.0)

2019-12-16

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.17.1 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.17.0 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.16.2 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.17.1 release
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.17.0 release
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.16.2 release

## [7.15.1](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.15.0...Okipa:7.15.1)

2019-12-11

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.16.1 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.16.1 release

## [7.15.0](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.14.5...Okipa:7.15.0)

2019-12-04

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.16.0 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.16.0 release

## [7.14.5](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.14.4...Okipa:7.14.5)

2019-11-27

* The extensions detection from mime types from the `Spatie\MediaLibrary\HasMedia\HasMediaTrait::extensionsFromMimeTypes()` method is now executed by `Symfony\Component\Mime\MimeTypes::getExtensions()` (which is far more reliable).
* The `mimes` validation is now executed before the `mimetypes` validation, in order to return a more comprehensible error for end user in case of wrong uploaded file type.
* The extensions detection from mime types from the `Spatie\MediaLibrary\HasMedia\HasMediaTrait::extensionsFromMimeTypes()` method is now executed by `Symfony\Component\Mime\MimeTypes::getExtensions()` (which is far more reliable)
* The `mimes` validation is now executed before the `mimetypes` validation, in order to return a more comprehensible error for end user in case of wrong uploaded file type

## [7.14.4](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.14.3...Okipa:7.14.4)

2019-11-25

* Fixed mimes extraction from mimes types, in order to remove the duplicated mimes during the constraints and legend generation.
* Fixed mimes extraction from mimes types, in order to remove the duplicated mimes during the constraints and legend generation

## [7.14.3](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.14.2...Okipa:7.14.3)

2019-10-17

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.14.2 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.14.2 release

## [7.14.2](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.14.1...Okipa:7.14.2)

2019-10-15

* Fixed the translations publication and overriding as specified on the Laravel documentation: https://laravel.com/docs/packages#translations.
* Fixed the translations publication and overriding as specified on the Laravel documentation: https://laravel.com/docs/packages#translations

## [7.14.1](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.14.0...Okipa:7.14.1)

2019-09-27

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.14.1 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.14.1 release

## [7.14.0](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.13.4...Okipa:7.14.0)

2019-09-26

* Added mimes validation generation: https://laravel.com/docs/validation#rule-mimes
* Updated validation process order: mime types and mimes validations now happens before dimensions validation.
* :warning: The `->validationConstraints()` method does now return an array, rather than a string before.
* :warning: Removed the `CollectionNotFound` exception in order to follow the base package behaviour.
* :warning: Removed the `ConversionsNotFound` exception in order to follow the base package behaviour.
* :warning: Replaced the `__('medialibrary.constraint.mimeTypes')` translation by `trans_choice('medialibrary.constraint.types')` translation, in order to provide clearer legends.
* Updated validation process order: mime types and mimes validations now happens before dimensions validation
* :warning: The `->validationConstraints()` method does now return an array, rather than a string before
* :warning: Removed the `CollectionNotFound` exception in order to follow the base package behaviour
* :warning: Removed the `ConversionsNotFound` exception in order to follow the base package behaviour
* :warning: Replaced the `__('medialibrary.constraint.mimeTypes')` translation by `trans_choice('medialibrary.constraint.types')` translation, in order to provide clearer legends

## [7.13.4](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.13.3...Okipa:7.13.4)

2019-09-25

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.14.0 release.
* you now have to set `version_urls` to `true` in the config file in order to have your image urls versioned.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.14.0 release
* you now have to set `version_urls` to `true` in the config file in order to have your image urls versioned

## [7.13.3](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.13.2...Okipa:7.13.3)

2019-09-25

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.13.0 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.12.4 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.12.3 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.13.0 release
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.12.4 release
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.12.3 release

## [7.13.2](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.13.1...Okipa:7.13.2)

2019-09-24

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.12.2 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.12.2 release

## [7.13.1](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.13.0...Okipa:7.13.1)

2019-09-13

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.12.1 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.12.1 release

## [7.13.0](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.12.0...Okipa:7.13.0)

2019-09-04

* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.12.0 release.
* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.12.0 release

## [7.12.0](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.11.0...Okipa:7.12.0)

2019-08-27

* Added automatic image file name version for cache busting when `config('medialibrary.image_name_versioning')` is set to true.
* Fixed missing translations loading in service provider.
* Implemented `spatie/laravel-medialibrary:7.10.1` release.
* Added automatic image file name version for cache busting when `config('medialibrary.image_name_versioning')` is set to true
* Fixed missing translations loading in service provider
* Implemented `spatie/laravel-medialibrary:7.10.1` release

## [7.11.0](https://github.com/Okipa/laravel-medialibrary-ext/releases/tag/7.11.0)

2019-08-27

* First extension release.
* First extension release
35 changes: 22 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
# Extra features for spatie/laravel-medialibrary package

[![Source Code](https://img.shields.io/badge/source-okipa/laravel--medialibrary--ext-blue.svg)](https://github.com/Okipa/laravel-medialibrary-ext)
[![Latest Version](https://img.shields.io/github/release/okipa/laravel-medialibrary-ext.svg?style=flat-square)](https://github.com/Okipa/laravel-medialibrary-ext/releases)
[![Total Downloads](https://img.shields.io/packagist/dt/okipa/laravel-medialibrary-ext.svg?style=flat-square)](https://packagist.org/packages/okipa/laravel-medialibrary-ext)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Build status](https://github.com/Okipa/laravel-medialibrary-ext/workflows/CI/badge.svg)](https://github.com/Okipa/laravel-medialibrary-ext/actions)
[![Coverage Status](https://coveralls.io/repos/github/Okipa/laravel-medialibrary-ext/badge.svg?branch=master)](https://coveralls.io/github/Okipa/laravel-medialibrary-ext?branch=master)
[![Quality Score](https://img.shields.io/scrutinizer/g/Okipa/laravel-medialibrary-ext.svg?style=flat-square)](https://scrutinizer-ci.com/g/Okipa/laravel-medialibrary-ext/?branch=master)
![Laravel Medialibrary Extension](/docs/laravel-medialibrary-ext.png)
<p align="center">
<a href="https://github.com/Okipa/laravel-medialibrary-ext/releases" title="Latest Stable Version">
<img src="https://img.shields.io/github/release/Okipa/laravel-medialibrary-ext.svg?style=flat-square" alt="Latest Stable Version">
</a>
<a href="https://packagist.org/packages/Okipa/laravel-medialibrary-ext" title="Total Downloads">
<img src="https://img.shields.io/packagist/dt/okipa/laravel-medialibrary-ext.svg?style=flat-square" alt="Total Downloads">
</a>
<a href="https://github.com/Okipa/laravel-medialibrary-ext/actions" title="Build Status">
<img src="https://github.com/Okipa/laravel-medialibrary-ext/workflows/CI/badge.svg" alt="Build Status">
</a>
<a href="https://coveralls.io/github/Okipa/laravel-medialibrary-ext?branch=master" title="Coverage Status">
<img src="https://coveralls.io/repos/github/Okipa/laravel-medialibrary-ext/badge.svg?branch=master" alt="Coverage Status">
</a>
<a href="https://img.shields.io/badge/License-MIT-blue.svg" title="License: MIT">
<img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT">
</a>
</p>

This package extension provides extra features for the [spatie/laravel-medialibrary](https://github.com/spatie/laravel-medialibrary) package.

Expand Down Expand Up @@ -89,7 +98,7 @@ Here is the list of the sentences available for translation:
Declaring your media validation rules like this:

```php
// in your user storing form request for example
// In your user storing form request for example
public function rules()
{
return [
Expand All @@ -102,7 +111,7 @@ public function rules()
Will generate:

```php
// example
// Example
['mimetypes:image/jpeg,image/png', 'mimes:jpeg,jpg,jpe,png', 'dimensions:min_width=60,min_height=20', 'max:5000'];
```

Expand All @@ -119,7 +128,7 @@ Will generate:
Adding a constraint caption under a file input:

```html
<!-- in your HTML form -->
<!-- In your HTML form -->
<label for="avatar">Choose a profile picture:</label>
<input type="file" id="avatar" name="avatar" value="{{ $user->getFirstMedia('avatar')->name }}">
<small>{{ $user->getMediaCaption('avatar') }}</small>
Expand All @@ -128,7 +137,7 @@ Adding a constraint caption under a file input:
Will generate:

```html
<!-- example -->
<!-- Example -->
Min. width: 150 px. Min. height: 70 px. Accepted types: jpeg, jpg, jpe, png. Max file size: 5Mb.
```

Expand Down
Loading

0 comments on commit 3c5d3aa

Please sign in to comment.