Composer require gives errors while installing barryvdh/laravel-dompdf - php

I'm quite new with Laravel and wrote my first app.
I'm using Laravel 5.4 with PHP 7.1.5 on Windows, but when I run the composer require barryvdh/laravel-dompdf command, I get following issues. I have followed many "possible solutions" but still it is not working.
This is the error:
Your requirements could not be resolved to an installable set of
packages.
Problem 1
- Installation request for barryvdh/laravel-dompdf ^0.8.1 -> satisfiable by barryvdh/laravel-dom
pdf[v0.8.1].
- barryvdh/laravel-dompdf v0.8.1 requires dompdf/dompdf ^0.8 -> satisfiable by dompdf/dompdf[v0.
8.0, v0.8.1, v0.8.2] but these conflict with your requirements or minimum-stability.

Don't composer update. If you have dompdf/dompdf in your composer.json just update it, specifying 0.8.* as version and running
composer update dompdf/dompdf
then
composer require barryvdh/laravel-dompdf
--
Running a generic composer update will affect all your other dependencies you may want keep as they currently are.
All the changes affected by your composer update command are then recorded in your composer.lock file.
When you'll move your project somewhere else or you'll deploy it on a server for example, the composer install command will read the composer.lock file and will install the exact version of your dependencies which are recorded in it. So you'll be sure about the version of your dependencies.

Run this command
composer require barryvdh/laravel-dompdf "^0.8.2" .

Delete your composer.lock file and run:
composer install

Check then dompdf/dompdf may updated e.g. 0.7.* or ~0.7.0
composer update;
composer require barryvdh/laravel-dompdf;

Related

Failed while installing a package using composer

iam tryin to use a cart package by using this command
composer require jason-napolitano/codeigniter4-cart-module
and it's failed. this is what it said
Using version dev-master for jason-napolitano/codeigniter4-cart-module
./composer.json has been updated
Running composer update jason-napolitano/codeigniter4-cart-module
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires jason-napolitano/codeigniter4-cart-module dev-master -> satisfiable by jason-napolitano/codeigniter4-cart-module[dev-master].
- jason-napolitano/codeigniter4-cart-module dev-master requires codeigniter4/framework ^4.0.3 -> satisfiable by codeigniter4/framework[v4.0.3, ..., v4.1.1] from composer repo (https://repo.packagist.org) but codeigniter4/framework[1.0.0+no-version-set] from root package repo has higher repository priority. The
packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
is it because my minimum-stability in composer.json is set to "stable"?
I presume you created your project by using composer create-project codeigniter4/framework. This effectively created a clean project for you without the .git folder, thus removing any metadata on what version of codeigniter4/framework package you installed. This is indicative by 1.0.0+no-version-set part of the error message.
The jason-napolitano/codeigniter4-cart-module package requires ^4.0.3 version of codeigniter4/framework, but since you have no version metadata in your project, install fails. This can be resolved by setting the version from which you bootstrapped your project manually in your root composer.json:
{
"name": "codeigniter4/framework",
"version": "4.0.3",
...
}
However, this is just a guess, since I have no insight into your main composer.json.
Your PHP is missing intl extension. It is useful for formatting currency, number and date/time as well as UCA-conformant collations, for message formatting and normalizing text..etc.
Check out Codeignitor 4 [Documentation][1]:
Follow the steps to install it in XAMPP -
Open [xampp_folder_path]/php/php.ini to edit.
Search for ;extension=intl and remove the ;.
Save the php.ini file and restart Apache.

Problem with TravisCI version matrix after updating to composer 2.0

After updating to Composer 2.0 I got into problems on doing my Travis.
I have a TYPO3 Extension, that I want to test with multiple TYPO3 Versions. Till yesterday I could do this with composer require nimut/typo3-complete:$TYPO3_VERSION (coming from the version Matrix).
After the update I got following error/information.
Cannot update only a partial set of packages without a lock file present.
Installation failed, reverting ./composer.json to its original content.
As I have no composer.lock in my repository, I tested my pipeline with a composer install first, and then did the update. This is all fine until I go to the next version as the dependencies are different, and the composer.lock from the composer install cannot update the additional dependencies.
I have tried it with composer require --dev nimut/typo3-complete:^10.4 --with-all-dependencies the response from composer:
Problem 1
- typo3/testing-framework is locked to version 4.15.2 and an update of this package was not requested.
- typo3/testing-framework 4.15.2 requires typo3/cms-backend ^9.3 -> found typo3/cms-backend[v9.3.0, ..., 9.5.x-dev] but it conflicts with another require.
Problem 2
- symfony/http-client v5.1.7 requires symfony/http-client-contracts ^2.2 -> found symfony/http-client-contracts[dev-main, dev-master, v2.2.0, v2.3.1, 2.3.x-dev (alias of dev-master)] but it conflicts with another require.
- nunomaduro/phpinsights v1.14.0 requires sensiolabs/security-checker ^6.0 -> satisfiable by sensiolabs/security-checker[v6.0.3].
- sensiolabs/security-checker v6.0.3 requires symfony/http-client ^4.3|^5.0 -> satisfiable by symfony/http-client[v5.1.7].
- nunomaduro/phpinsights is locked to version v1.14.0 and an update of this package was not requested.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
The -W option is the one I'm trying out already. I have tried both -w and -W, no luck so far.
I'm not sure how to get around this problem yet, your input your be very helpful.
Link to .travis.yml
https://github.com/AOEpeople/crawler/blob/master/.travis.yml#L50
Link to Travis Build where testing it out.
https://travis-ci.org/github/AOEpeople/crawler/jobs/738603105#L1138
The issue with composer require was reported and fixed in PR 9336 on Composer's GitHub repository. It will be in Composer 2.0.2 just about to be released now. So you can upgrade to 2.0.2 and it should resolve your problem.
To explain why your workaround failed:
composer require nimut/typo3-complete:$TYPO3_VERSION edits the composer.json file to add "nimut/typo3-complete": "^$TYPO3_VERSION". Then it runs composer update nimut/typo3-complete, or (on Composer 1.x or 2.0.2+) a plain composer update if no lock file exists yet.
If you run a composer install without a lock file first, this executes a composer update because there is no lock file. The subsequent composer require then still edits the json file and now runs composer update nimut/typo3-complete because there is a lock file. Even with all the dependency options enabled, this may have a different outcome or even a conflict from running a plain composer update as you are restricting the update to only the new package and its dependencies.

Setting up php-casperjs with composer

I'm having trouble setting up php-casperjs for my project. I've never used composer before, so I'm not exactly sure what I'm doing wrong.
I got xampp installed on Windows with php version 5.6.12
Here are the steps I completed so far.
Downloaded and installed composer. It launches successfully from the command prompt.
Downloaded php-casperjs and extracted composer.json and src/Casper.php into my project folder C:\xampp\htdocs\test
Navigated to the project folder in the command prompt and ran composer install command which installed 22 packages
Then I ran composer require phpcasperjs/phpcasperjs command and here I ran into problems. I get the following error message
Using version ^1.2 for phpcasperjs/phpcasperjs
./composer.json has been updated
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
- The requested package phpcasperjs/phpcasperjs No version set (parsed as 1.0.0) is satisfiable by phpcasperjs/phpcasperjs[No version
set (parsed as 1.0.0)] but these conflict with your requirements or
minimum-stability.
Installation failed, reverting ./composer.json to its original
content.
When I run the following php code
use Browser\Casper;
$casper = new Casper();
I get Fatal error: Class 'Browser\Casper' not found in C:\xampp\htdocs\test\test.php on line 3
Step1: Go to you project directory and create a file "composer.json"
codes for composer.json
{
"require": {
"monolog/monolog": "1.0.*"
}
}
Note: You can create you composer.json with your required packages but i just created a simple composer.json file with monolog/monolog package. For your understanding you can follow my steps (this). You can remove the package monolog later on.
Now navigate to the project directory where composer.json file located
Run the following command:
composer require phpcasperjs/phpcasperjs
And you faced the above problem because of wrong or mismatched version of the intended package. Keep in mind that you always can create composer.json with your custom packages and their versions and which will be your package manager. For more detail about composer please visit Link

PHP Composer issue (Technic Solder API Setup)

I am in the process of setting up a webserver on Ubuntu 14.04 LTS, and have got my LEMP stack setup properly, as well as installed composer without issue.
When I try to configure composer for use with the solder package via the following command:
$composer require solder/solder
it spits out the following error:
Using version v0.7.3.1 for solder/solder
./composer.json has been created
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
- Installation request for solder/solder v0.7.3.1 -> satisfiable by solder/solder[v0.7.3.1].
- solder/solder v0.7.3.1 requires composer/composer 1.0.0-alpha9 -> satisfiable by composer/composer[1.0.0-alpha9] but these conflict with your requirements or minimum-stability.
Installation failed, deleting ./composer.json.
I even tried running it in sudo mode, same issue (yes, I know your not supposed to run composer commands in sudo or root level access mode, but I tried it just to rule it out as the issue)
Any idea what is causing this, and how to fix it?
The solder/solder package requires the composer/composer package explicitly in version 1.0.0-alpha9. Composer however (ignore the confusing fact that you're using Composer to install Composer for a moment), will not install "unstable" software (i.e. alpha, beta or dev versions) by default.
You can circumvent this by setting the minimum-stability setting in your composer.json file. For this, create the composer.json file by hand:
{
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"solder/solder": "0.7.3.1"
}
}
Followed by running composer install on the command-line.
In comparison, the composer require command that you're using does nothing else that adding the solder/solder key/value pair to the composer.json's require section (also implicitly creating the file, but without the minimum-stability setting) and running an implicit composer install.

How would I only update one composer dependency?

I expected that
composer update videlalvaro/php-amqplib
would only update one dependency, but instead of that it updates all.
What am I missing?
PS: this dependency is defined as "videlalvaro/php-amqplib": "2.2.0" in composer.json
PPS: the composer version used is 3da05c68f9561fa822c522b1815435ff990493ff 2013-10-02 14:25:06
PPPS: the actual output:
$ composer.phar update videlalvaro/php-amqplib --no-dev
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- Installation request for symfony/icu == 1.2.0.0 -> satisfiable by symfony/icu[v1.2.0].
The command composer update videlalvaro/php-amqplib does just update that dependency. However it doesn't disable the other dependency checking that Composer does.
What the error message is complaining about is that the lib-icu is not available on your system. Apparently this would be solved by installing the PHP Intl extension.
You would see similar issues if you did a composer update on a project that required PHP 5.5 in one of it's requires, downgraded to PHP 5.4 and then ran composer update on a separate require, that didn't require PHP 5.5. Even though you wouldn't be updating the require that needs PHP 5.5, the requirements for that package would not be resolvable, and so Composer would fail.
In your case, even though you're just trying to update videlalvaro/php-amqplib to the latest version, the requirements for symfony/icu aren't met, and so the composer update fails.
Edit
To try to be helpful, I'm guessing you re-installed PHP since you last did an update, and either removed or forgot to install the PHP Intl extension. Composer can't satisfactorily satisfy the requirements your composer.json is setting, and so is defaulting to doing nothing, rather than knowingly doing an update where the requirements aren't met.
So basically, you need to install the PHP extensions that are required for your existing installed software to run, and then Composer will be able to update the single package you want to update, as well as meet the requirements for the other packages.
tl;dr:
You can list more than one dependency to update in one command:
composer update one/dependency second/dependency other/dependency
Story:
If you want to update only one dependency (composer update some/dependency), you may face an issue that request is not satisfiable due to some other dependency is installed in wrong version. And that one does not necessarily must be listed in your composer.json, it could be just dependency of some other dependency.
E.g. I wanted to update only and only google/apiclient, but calling composer update google/apiclient complained, that google/auth (dependency of apiclient) requires guzzlehttp/psr7 in version 1.2.3. I had 1.3.0 installed. The guzzlehttp/psr7 was not listed in my composer.json. What I had to do, was to call:
composer update guzzlehttp/psr7 google/apiclient
and that's it! Just update the package you want, and if composer tells you, that you need to update (or downgrade :-)) some other package, list it in the command.
I had a similar case due to security reasons on a GitHub repository.
I solved updating the dependency to a specific version like this:
composer require phpseclib/phpseclib:2.0.31
If you are working with virtual environments like docker containers (ddev, lando, etc..) before running it you should connect to the container with a:
ddev ssh
To overcome this kind of dependency problem during the update of a specific package you should specify all the specific packages versions before running their update altogether.
In your case something like this:
composer require videlalvaro/php-amqplib:2.2.0 --no-update
composer require symfony/icu:1.2.0 --no-update
composer require lib-icu:4.4 --no-update
composer update videlalvaro/php-amqplib symfony/icu lib-icu

Categories