psliwa / image-optimizer

Image optimization / compression library. This library is able to optimize png, jpg and gif files in very easy and handy way. It uses optipng, pngquant, pngcrush, pngout, gifsicle, jpegoptim and jpegtran tools.
MIT License
906 stars 141 forks source link

Evaluate the lowering of PHP version #74

Closed picov closed 3 years ago

picov commented 3 years ago

I wondering if there is a way to lower PHP requirements back to 5.6.

I'm asking for this because I suspect that the actual 7.1 requirement is related only to symfony stuff. In another package (phpmyadmin/motranslator) that use similar stuff I'm able lo force the php version with composer (because the last code base written for PHP 7.2+ give parsing error when used with 5.6)

Default installation on PHP 7.4

$ composer require phpmyadmin/motranslator Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 10 installs, 0 updates, 0 removals

Installing psr/container (1.0.0): Loading from cache Installing symfony/service-contracts (v2.2.0): Loading from cache Installing psr/cache (1.0.1): Downloading (100%) Installing symfony/polyfill-php80 (v1.20.0): Loading from cache Installing symfony/var-exporter (v5.1.8): Loading from cache Installing symfony/cache-contracts (v2.2.0): Loading from cache Installing psr/log (1.1.3): Loading from cache Installing symfony/cache (v5.1.8): Loading from cache Installing symfony/expression-language (v4.4.16): Loading from cache Installing phpmyadmin/motranslator (4.0): Downloading (100%) symfony/service-contracts suggests installing symfony/service-implementation Generating autoload files Switch to a 5.6 compatible version

$ composer config platform.php 5.6 $ composer update Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 4 installs, 2 updates, 5 removals

Removing psr/container (1.0.0) Removing symfony/polyfill-php80 (v1.20.0) Removing symfony/var-exporter (v5.1.8) Removing symfony/cache-contracts (v2.2.0) Removing symfony/service-contracts (v2.2.0) Installing paragonie/random_compat (v2.0.19): Loading from cache Installing symfony/polyfill-php70 (v1.19.0): Loading from cache Installing psr/simple-cache (1.0.1): Loading from cache Installing symfony/polyfill-apcu (v1.19.0): Loading from cache Downgrading symfony/cache (v5.1.8 => v3.4.46): Loading from cache Downgrading symfony/expression-language (v4.4.16 => v3.4.46): Loading from cache paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.) Writing lock file Generating autoload files

I've tried the same with psliwa/image-optimizer but it not works

$ composer config platform.php 5.6 $ composer update Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

Problem 1

psliwa commented 3 years ago

Hi,

The codebase of this library is written using php 7.1+ features so there is no way to lower php version requirements in composer.json. Php 5.6 is rather old and it even doesn't have security fixes as far as I know. If you want to use this library with php 5.6 you need to use 1.2.3 version which should work on this php version.