T
T
Tokenchik2020-03-02 20:01:50
Composer
Tokenchik, 2020-03-02 20:01:50

How to correctly specify the dependencies of your package?

Hello.
I have one small package for laravel, inside it uses the following dependencies:

"require-dev": {
    "orchestra/testbench": "^[email protected]",
    "phpunit/phpunit": "^8.0"
},

Ci runs tests for php versions 7.2-7.3. For 7.3, everything goes ok, but for 7.2, the tests began to fall with the error

Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for laravel/framework 8.x-dev -> satisfiable by laravel/framework[8.x-dev].
- laravel/framework 8.x-dev requires php ^7.3 -> your PHP version (7.2.15) does not satisfy that requirement.
Problem 2
- Installation request for laravel/framework dev-master -> satisfiable by laravel/framework[dev-master].
- laravel/framework dev-master requires php ^7.3 -> your PHP version (7.2.15) does not satisfy that requirement.
Problem 3
- Installation request for orchestra/testbench 6.0.x-dev -> satisfiable by orchestra/testbench[6.0.x-dev].
- orchestra/testbench 6.0.x-dev requires php >=7.3 -> your PHP version (7.2.15) does not satisfy that requirement.
Problem 4
- Installation request for orchestra/testbench dev-master -> satisfiable by orchestra/testbench[dev-master].
- orchestra/testbench dev-master requires php >=7.3 -> your PHP version (7.2.15) does not satisfy that requirement.
Problem 5
- Installation request for orchestra/testbench-core 6.0.x-dev -> satisfiable by orchestra/testbench-core[6.0.x-dev].
- orchestra/testbench-core 6.0.x-dev requires php >=7.3 -> your PHP version (7.2.15) does not satisfy that requirement.
Problem 6
- Installation request for orchestra/testbench-core dev-master -> satisfiable by orchestra/testbench-core[dev-master].
- orchestra/testbench-core dev-master requires php >=7.3 -> your PHP version (7.2.15) does not satisfy that requirement.

The error appeared just after adding the require-dev section , tell me how to correctly specify the version of the packages used for testing in order to continue using the package in projects with version 7.2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Talalaev, 2020-03-03
@Tokenchik

After reading the comments, I noticed that you specified the php version too hard.
Personally, I advise you to satweet as little as possible (signed greater than or exactly), which specifically your package will work on.
For example, if your specific code is capable of running on 5.4, install it, maybe your package will be used on older systems. Naturally, if there are direct dependencies that need more a priori, then there will be no point in this. But it is considered good practice.
Those in your particular case
"php": ">=7.2"
But if there is, maybe put "php": ">=5.4"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question