Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump dependencies to supported libraries only #1549

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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']
Expand All @@ -33,7 +33,7 @@ jobs:
stability: 'stable'

# Test each supported Symfony version with the lowest supported PHP version
- php: '8.0'
- php: '8.1'
dependencies: highest
symfony: '5.4.*'
stability: 'stable'
Expand Down
77 changes: 20 additions & 57 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,18 @@ 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
Sometime, you may may need to modify your filter at runtime. You can do so by
passing the template helper an options array.

*For Twig-based template, use:*

```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 +241,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 +261,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 @@ -323,15 +289,12 @@ lifting for you.
```php
<?php

class MyController extends Controller
class MyController extends AbstractController
{
public function indexAction()
{
/** @var FilterService */
$imagine = $this
->container
->get('liip_imagine.service.filter');
use Liip\ImagineBundle\Service\FilterService;

public function index(FilterService $imagine)
{
// 1) Simple filter, OR
$resourcePath = $imagine->getUrlOfFilteredImage('uploads/foo.jpg', 'my_thumb');

Expand Down Expand Up @@ -361,7 +324,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 +335,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
46 changes: 22 additions & 24 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,36 @@
}
},
"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": "^5.4|^6.4|^7.0",
"symfony/finder": "^5.4|^6.4|^7.0",
"symfony/framework-bundle": "^5.4|^6.4|^7.0",
"symfony/mime": "^5.4|^6.4|^7.0",
"symfony/options-resolver": "^5.4|^6.4|^7.0",
"symfony/process": "^5.4|^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": "^5.4|^6.4|^7.0",
"symfony/cache": "^5.4|^6.4|^7.0",
"symfony/console": "^5.4|^6.4|^7.0",
"symfony/dependency-injection": "^5.4|^6.4|^7.0",
"symfony/form": "^5.4|^6.4|^7.0",
"symfony/messenger": "^5.4|^6.4|^7.0",
"symfony/phpunit-bridge": "^5.4|^6.4|^7.0",
"symfony/validator": "^5.4|^6.4|^7.0",
"symfony/yaml": "^5.4|^6.4|^7.0"
},
"suggest": {
"ext-exif": "required to read EXIF metadata from images",
Expand All @@ -67,8 +66,7 @@
"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
67 changes: 27 additions & 40 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,42 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/7.5/phpunit.xsd"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="true"
bootstrap="./tests/bootstrap.php">

<testsuites>
<testsuite name="liip/imagine-bundle test suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src</directory>
<exclude>
<directory>./src/Resources</directory>
</exclude>
</whitelist>
</filter>

<logging>
<log type="coverage-clover" target="var/build/clover.xml"/>
</logging>

<php>
<ini name="error_reporting" value="-1" />
<ini name="intl.default_locale" value="en" />
<ini name="intl.error_level" value="0" />
<ini name="memory_limit" value="-1" />
</php>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" forceCoversAnnotation="true" bootstrap="./tests/bootstrap.php">
<coverage>
<include>
<directory>./src</directory>
</include>
<exclude>
<directory>./src/Resources</directory>
</exclude>
<report>
<clover outputFile="var/build/clover.xml"/>
</report>
</coverage>
<testsuites>
<testsuite name="liip/imagine-bundle test suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<logging/>
<php>
<ini name="error_reporting" value="-1"/>
<ini name="intl.default_locale" value="en"/>
<ini name="intl.error_level" value="0"/>
<ini name="memory_limit" value="-1"/>
</php>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
</phpunit>