5

I can't seem to install a package because I need to use php 5.6 and the minimum is 7.

I tried

composer require mopo922/laravel-treats --ignore-platform-reqs

  [InvalidArgumentException]
  Could not find package mopo922/laravel-treats at any version matching your PHP version 5.6.32.0

Then I temporary removed the platform requirement from the composer file and successfully installed but now I can't do "composer update"

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
    - mopo922/laravel-treats v2.0.4 requires php >=7.0 -> your PHP version (7.2.1) overridden by "config.platform.php" version (5.6.32) does not satisfy that requirement.
    - mopo922/laravel-treats v2.0.3 requires php >=7.0 -> your PHP version (7.2.1) overridden by "config.platform.php" version (5.6.32) does not satisfy that requirement.
    - mopo922/laravel-treats v2.0.2 requires php >=7.0 -> your PHP version (7.2.1) overridden by "config.platform.php" version (5.6.32) does not satisfy that requirement.
    - mopo922/laravel-treats v2.0.1 requires php >=7.0 -> your PHP version (7.2.1) overridden by "config.platform.php" version (5.6.32) does not satisfy that requirement.
    - mopo922/laravel-treats v2.0.0 requires php >=7.0 -> your PHP version (7.2.1) overridden by "config.platform.php" version (5.6.32) does not satisfy that requirement.
    - mopo922/laravel-treats v2.0.4 requires php >=7.0 -> your PHP version (7.2.1) overridden by "config.platform.php" version (5.6.32) does not satisfy that requirement.
    - Installation request for mopo922/laravel-treats ^2.0 -> satisfiable by mopo922/laravel-treats[v2.0.0, v2.0.1, v2.0.2, v2.0.3, v2.0.4].

Any way composer can ignore a specific package?

2
  • How do you expect to use this package on PHP 5.6 if it requires PHP 7.0?
    – rob006
    Jun 26, 2018 at 21:20
  • it's a small package and the feature I want is php 5.6 compatible(because it supports eloquent 5.4 which is php 5.6 compatible) as far as I know, see mopo922/laravel-treats
    – orbitory
    Jun 27, 2018 at 6:11

1 Answer 1

4

I see three possibilities here:

  1. extract the feature you need from mopo922/laravel-treats and use it directly in your project. If its just a small feature it shouldnt have a big impact to not include it by composer. Its better than messing up the version constraints imho.
  2. use composer update --ignore-platform-reqs
  3. use the platform config option and just fake that you have PHP 7. see: How to always use ignore-platform-reqs flag when running composer? This however could lead to other problems, f.e when installing new packages which use the PHP7 constraint although you actually dont support it. So be carefully with it. This is basically the same as removing the platform requirements when your dev machine has PHP 7.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.