Skip to content

Commit

Permalink
Merge pull request #1557 from liip/tac
Browse files Browse the repository at this point in the history
bump dependencies and drop legacy support
  • Loading branch information
dbu authored Jan 6, 2024
2 parents f5dd215 + 6751564 commit fcc9ef0
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 850 deletions.
36 changes: 13 additions & 23 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,45 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.0', '8.1', '8.2']
php: ['8.1', '8.2', '8.3']
dependencies: [highest]
symfony: ['*']
stability: ['stable']
include:
# Minimum supported dependencies with the oldest supported PHP version
- php: '8.0'
- php: '8.1'
dependencies: lowest
symfony: '*'
stability: 'stable'

# Minimum supported dependencies with the latest supported PHP version
- php: '8.2'
- php: '8.3'
dependencies: lowest
symfony: '*'
stability: 'stable'

# Test each supported Symfony version with the lowest supported PHP version
- php: '8.0'
dependencies: highest
symfony: '5.4.*'
stability: 'stable'

- php: '8.1'
dependencies: highest
symfony: '6.4.*'
stability: 'stable'

# Test Symfony 6.4 dev version
- php: '8.2'
dependencies: highest
symfony: '6.4.*'
stability: 'dev'
symfony: '7.0.*'
stability: 'stable'

# Test Symfony 7.0 dev version
- php: '8.2'
- php: '8.3'
dependencies: highest
symfony: '7.0.*'
stability: 'stable'

# Test Symfony 7.1 dev
- php: '8.2'
dependencies: highest
symfony: '7.1.*'
stability: 'dev'

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -76,19 +76,9 @@ jobs:
composer global require --no-interaction --no-progress symfony/flex
composer config extra.symfony.require ${{ matrix.symfony }}
- name: Remove non-compatible dependencies with Symfony 7
if: matrix.symfony == '7.0.*'
run: |
composer remove enqueue/enqueue-bundle symfony/templating --dev --no-update
- name: Set minimum-stability
run: composer config minimum-stability ${{ matrix.stability }}

# Incompatible with symfony/framework-bundle v3
- name: Remove symfony/messenger
if: ${{ matrix.php == '7.2' && matrix.symfony == '3.4.*' }}
run: composer remove --dev --no-update symfony/messenger

- name: Update project dependencies
uses: ramsey/composer-install@v2
with:
Expand Down
10 changes: 0 additions & 10 deletions .phpstan/iterable_types_baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,6 @@ parameters:
count: 1
path: ../src/Imagine/Cache/CacheManager.php

-
message: "#^Method Liip\\\\ImagineBundle\\\\Imagine\\\\Cache\\\\Resolver\\\\AmazonS3Resolver\\:\\:__construct\\(\\) has parameter \\$objUrlOptions with no value type specified in iterable type array\\.$#"
count: 1
path: ../src/Imagine/Cache/Resolver/AmazonS3Resolver.php

-
message: "#^Property Liip\\\\ImagineBundle\\\\Imagine\\\\Cache\\\\Resolver\\\\AmazonS3Resolver\\:\\:\\$objUrlOptions type has no value type specified in iterable type array\\.$#"
count: 1
path: ../src/Imagine/Cache/Resolver/AmazonS3Resolver.php

-
message: "#^Method Liip\\\\ImagineBundle\\\\Imagine\\\\Cache\\\\Resolver\\\\AwsS3Resolver\\:\\:__construct\\(\\) has parameter \\$getOptions with no value type specified in iterable type array\\.$#"
count: 1
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ for a given releases. Unreleased, upcoming changes will be updated here periodic

## 3.x (unreleased)

- Dropped support for PHP templating [#1549](https://github.com/liip/LiipImagineBundle/pull/1549).
- Dropped support for old PHP versions, minimum version is now 8.1 [#1549](https://github.com/liip/LiipImagineBundle/pull/1549).
- Removed legacy `AmazonS3Resolver` for the outdated `amazonwebservices/aws-sdk-for-php`, use `AwsS3Resolver` with `aws/aws-sdk-php` instead [#1549](https://github.com/liip/LiipImagineBundle/pull/1549).
- Removed deprecated code and BC for old Symfony versions.
- The response when the `filter` parameter in a resolve request is not an array is now 400 bad request, and no longer 404 not found.
- Simplified the `ProxyResolver` to no longer do the undocumented regex replace logic on domain names (reverting [#687](https://github.com/liip/LiipImagineBundle/pull/687)).
Expand Down
81 changes: 21 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ our [data loaders](http://symfony.com/doc/current/bundles/LiipImagineBundle/data
and [cache resolvers](http://symfony.com/doc/current/bundles/LiipImagineBundle/cache-resolvers.html)
operate correctly. Use the following boilerplate in your configuration file.

```yml
# app/config/config.yml
```yaml
# config/packages/liip_imagine.yaml

liip_imagine :

Expand Down Expand Up @@ -149,7 +149,7 @@ name `my_thumb`) with two *filters* configured: the `thumbnail` and `background`
*filters*.

```yml
# app/config/config.yml
# config/packages/liip_imagine.yaml
liip_imagine :
resolvers :
Expand Down Expand Up @@ -193,18 +193,10 @@ There are a number of additional [filters](http://symfony.com/doc/current/bundle
but for now you can use your newly defined ``my_thumb`` *filter set* immediately
within a template.

*For Twig-based template, use:*

```twig
<img src="{{ asset('/relative/path/to/image.jpg') | imagine_filter('my_thumb') }}" />
```

*Or, for PHP-based template, use:*

```php
<img src="<?php $this['imagine']->filter('/relative/path/to/image.jpg', 'my_thumb') ?>" />
```

Behind the scenes, the bundle applies the filter(s) to the image on-the-fly
when the first page request is served. The transformed image is then cached
for subsequent requests. The final cached image path would be similar to
Expand All @@ -217,7 +209,7 @@ rendered via the template helper. This is often caused by having
images are rendered, it is strongly suggested to disable this option:

```yml
# app/config/config_dev.yml
# config/packages/web_profiler.yaml
web_profiler :
intercept_redirects : false
Expand All @@ -226,37 +218,17 @@ web_profiler :

### Runtime Options

Sometime, you may have a filter defined that fulfills 99% of your usage
scenarios. Instead of defining a new filter for the erroneous 1% of cases,
you may instead choose to alter the behavior of a filter at runtime by
passing the template helper an options array.

*For Twig-based template, use:*
If you need to set filter options at runtime, you can pass options to the filter:

```twig
{% set runtimeConfig = {"thumbnail": {"size": [50, 50] }} %}
<img src="{{ asset('/relative/path/to/image.jpg') | imagine_filter('my_thumb', runtimeConfig) }}" />
```

*Or, for PHP-based template, use:*

```php
<?php
$runtimeConfig = array(
"thumbnail" => array(
"size" => array(50, 50)
)
);
?>
<img src="<?php $this['imagine']->filter('/relative/path/to/image.jpg', 'my_thumb', $runtimeConfig) ?>" />
```


### Path Resolution

Sometime you need to resolve the image path returned by this bundle for a
Sometimes you need to resolve the image path returned by this bundle for a
filtered image. This can easily be achieved using Symfony's console binary
or programmatically from within a controller or other piece of code.

Expand All @@ -268,15 +240,15 @@ You can resolve an image URL using the console command
relative image paths (which must be separated by a space).

```bash
$ php bin/console liip:imagine:cache:resolve relative/path/to/image1.jpg relative/path/to/image2.jpg
php bin/console liip:imagine:cache:resolve relative/path/to/image1.jpg relative/path/to/image2.jpg
```

Additionally, you can use the ``--filter`` option to specify which filter
you want to resolve for (if the ``--filter`` option is omitted, all
available filters will be resolved).

```bash
$ php bin/console liip:imagine:cache:resolve relative/path/to/image1.jpg --filter=my_thumb
php bin/console liip:imagine:cache:resolve relative/path/to/image1.jpg --filter=my_thumb
```


Expand All @@ -288,24 +260,17 @@ have the service assigned to a variable called `$imagineCacheManager`,
you would run:

```php
$imagineCacheManager->getBrowserPath('/relative/path/to/image.jpg', 'my_thumb');
```
Often, you need to perform this operation in a controller. Assuming your
controller inherits from the base Symfony controller, you can take advantage
of the inherited ``get`` method to request the ``liip_imagine.cache.manager``
service, from which you can call ``getBrowserPath`` on a relative image
path to get its resolved location.
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
```php
/** @var CacheManager */
$imagineCacheManager = $this->get('liip_imagine.cache.manager');
public function __construct(private CacheManager $imageCacheManager) {
}
/** @var string */
$resolvedPath = $imagineCacheManager->getBrowserPath('/relative/path/to/image.jpg', 'my_thumb');
public function doSomething() {
$this->imagineCacheManager->getBrowserPath('/relative/path/to/image.jpg', 'my_thumb');
}
```


## Filters

This bundle provides a set of built-in filters and you may easily
Expand All @@ -317,21 +282,17 @@ from our documentation.
## Use as a Service

If you need to use your defined "filter sets" from within your controller, you
can fetch this bundle's FilterService from the service container to do the heavy
lifting for you.
can inject the bundle's FilterService to do the heavy lifting for you.

```php
<?php
class MyController extends Controller
use Liip\ImagineBundle\Service\FilterService;
class MyController extends AbstractController
{
public function indexAction()
public function index(FilterService $imagine)
{
/** @var FilterService */
$imagine = $this
->container
->get('liip_imagine.service.filter');
// 1) Simple filter, OR
$resourcePath = $imagine->getUrlOfFilteredImage('uploads/foo.jpg', 'my_thumb');
Expand Down Expand Up @@ -361,7 +322,7 @@ assets from. For many installations this will be sufficient, but sometime you
may need to load images from other locations. To do this, you must set the
`data_root` parameter in your configuration (often located at `app/config/config.yml`).

```yml
```yaml
liip_imagine:
loaders:
default:
Expand All @@ -372,7 +333,7 @@ liip_imagine:
As of version `1.7.2` you can register multiple data root paths, and the
file locator will search each for the requested file.

```yml
```yaml
liip_imagine:
loaders:
default:
Expand Down
48 changes: 22 additions & 26 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,35 @@
}
},
"require": {
"php": "^8.0",
"php": "^8.1",
"ext-mbstring": "*",
"imagine/imagine": "^1.3.2",
"symfony/filesystem": "^5.3|^6.0|^7.0",
"symfony/finder": "^5.3|^6.0|^7.0",
"symfony/framework-bundle": "^5.3|^6.0|^7.0",
"symfony/mime": "^5.3|^6.0|^7.0",
"symfony/options-resolver": "^5.3|^6.0|^7.0",
"symfony/process": "^5.3|^6.0|^7.0",
"symfony/filesystem": "^6.4|^7.0",
"symfony/finder": "^6.4|^7.0",
"symfony/framework-bundle": "^6.4|^7.0",
"symfony/mime": "^6.4|^7.0",
"symfony/options-resolver": "^6.4|^7.0",
"symfony/process": "^6.4|^7.0",
"twig/twig": "^2.9|^3.0"
},
"require-dev": {
"ext-gd": "*",
"amazonwebservices/aws-sdk-for-php": "^1.0",
"aws/aws-sdk-php": "^2.4|^3.0",
"doctrine/persistence": "^1.3|^2.0",
"league/flysystem": "^1.0|^2.0|^3.0",
"aws/aws-sdk-php": "^3.0",
"doctrine/persistence": "^2.0",
"league/flysystem": "^3.0",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-symfony": "^1.0",
"psr/cache": "^1.0|^2.0|^3.0",
"psr/log": "^1.0",
"symfony/browser-kit": "^5.3|^6.0|^7.0",
"symfony/cache": "^5.3|^6.0|^7.0",
"symfony/console": "^5.3|^6.0|^7.0",
"symfony/dependency-injection": "^5.3|^6.0|^7.0",
"symfony/form": "^5.3|^6.0|^7.0",
"symfony/messenger": "^5.3|^6.0|^7.0",
"symfony/phpunit-bridge": "^5.3|^6.0|^7.0",
"symfony/templating": "^5.3|^6.0|^7.0",
"symfony/validator": "^5.3|^6.0|^7.0",
"symfony/yaml": "^5.3|^6.0|^7.0"
"psr/cache": "^3.0",
"psr/log": "^1.0|^2.0|^3.0",
"symfony/browser-kit": "^6.4|^7.0",
"symfony/cache": "^6.4|^7.0",
"symfony/console": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/form": "^6.4|^7.0",
"symfony/messenger": "^6.4|^7.0",
"symfony/phpunit-bridge": "^7.0.2",
"symfony/validator": "^6.4|^7.0",
"symfony/yaml": "^6.4|^7.0"
},
"suggest": {
"ext-exif": "required to read EXIF metadata from images",
Expand All @@ -61,14 +59,12 @@
"ext-imagick": "required to use imagick driver",
"ext-mongodb": "required for mongodb components",
"alcaeus/mongo-php-adapter": "required for mongodb components",
"amazonwebservices/aws-sdk-for-php": "required to use AWS version 1 cache resolver",
"aws/aws-sdk-php": "required to use AWS version 2/3 cache resolver",
"doctrine/mongodb-odm": "required to use mongodb-backed doctrine components",
"league/flysystem": "required to use FlySystem data loader or cache resolver",
"monolog/monolog": "A psr/log compatible logger is required to enable logging",
"rokka/imagine-vips": "required to use 'vips' driver",
"symfony/messenger": "If you like to process images in background",
"symfony/templating": "required to use deprecated Templating component instead of Twig"
"symfony/messenger": "If you like to process images in background"
},
"config": {
"sort-packages": true
Expand Down
Loading

0 comments on commit fcc9ef0

Please sign in to comment.