How to fix fzaninotto/faker packagist
"This package is abandoned and no longer maintained. No replacement package was suggested."
in composer 2.0.11 version and i used php 8.0.0?
The quick way is
composer remove fzaninotto/faker
Then install
composer require fakerphp/faker --dev
You can use the new package faker (fork).
Remove the faker abandoned
composer remove vendor/fzaninotto/faker
Install the new package
composer require fakerphp/faker
And replace it in your composer.json
"require-dev": {
"fakerphp/faker": "^1.13.0",
}
When running composer require league/flysystem-aws-s3-v3 I get:
league/flysystem-aws-s3-v3[2.0.0, ..., 2.x-dev] require league/flysystem ^2.0.0 -> found league/flysystem[2.0.0-alpha.1, ..., 2.x-dev] but the package is fixed to 1.1.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
In my composer.json there is no mention of league/flysystem, but it does appear in my composer.lock as "league/flysystem": "^1.1",. It looks like I have a few packages (like spatie/laravel-backup) that have this as an dependancy.
How do I proceed? I'm not sure how to update a package that other packages have as an dependancy, and that these other packages have also fixed to a specific version.
As you've found already: spatie/laravel-backup is not yet compatible with league/flysystem v2 (which is pretty new, it got released... yesterday!).
Simply require the "old" version of that AWS package through composer require league/flysystem-aws-s3-v3:"^1.0".
After all, this is not a problem of Laravel itself.
I am using the latest version of laravel V8.4.0 (JULY 2021)
I solve this by:
Deleting composer.lock in the root folder of the project
running composer require league/flysystem-aws-s3-v3:"~1.0"
For Laravel 8 use
composer require --with-all-dependencies league/flysystem-aws-s3-v3 "^1.0"
It is a problem with Laravel. Laravel v8 does not support league/flysystem v2 yet. v9 will be shipped with a support for it: https://github.com/laravel/framework/pull/33612
For those on Laravel 9, you'll need to upgrade to v3.0 instead.
composer require -W league/flysystem-aws-s3-v3 "^3.0"
After deleting compose.lock
I ran composer outdated command:
$ composer outdated
phpdocumentor/type-resolver 0.4.0 0.7.1
but looking inside composer.json, I see no such package. In my case there is no type-resolver.
How do I find an outdated package that is missing in composer.json belongs to and how do I update it?
Composer install not only packages that are listed directly in composer.json but also packages that are dependencies of packages that are listed in composer.json. Assuming you have in composer package vendor/A and this package requires vendor/B you will have installed both A and B packages.
So in your case you can run:
composer update phpdocumentor/type-resolver
to try to update this package.
Of course it does not mean it will be possible to update this way. It's possible that you might need to run:
composer update
but this will update all packages (and depends on scenario this is what you can accept or maybe you don't want to update all packages).
It's also possible that it won't be possible to update this package because other package that is used has phpdocumentor/type-resolver dependency set to for example 0.4.* so 0.7 version is not compatible with this package and version 0.7 won't be installed
I'm trying to remove a package from my application and I've run composer remove --no-update package/name, now all this does is remove the entry in composer.json but when I run composer show -i, I see the package is still installed, is there anyway to completely remove a package without running update?
I think this is exactly what the --no-update option is intended to do.
composer remove package/name should remove package/name from your project without updating other packages than package/name.
It's the same if you remove the entry from your composer.json and then run composer update package/name. It will update this specific package but no others!
If you activate the --no-update option it omits the update, so it only removes the entry.
I think what the --no-update option is intended to do is, this will avoid composer update.
for eg composer require "magento/magento-cloud-metapackage":">=2.3.3 <2.3.4" --no-update only update composer.json file not composer.lock file
while composer require "magento/magento-cloud-metapackage":">=2.3.3 <2.3.4"
updates both composer.json and composer.lock file
I'm using Composer to install multiple packages using the following syntax:
{
"require": {
"aws/aws-sdk-php": "2.*",
"vimeo/vimeo-api": "1.1.*",
"phpoffice/phpexcel": "dev-master"
}
}
The above works just fine, but now I'd like to add tcpdf via composer. I found this code here but am not sure how to integrate with my current requires. One thing that I tried was to just add it to the end, but I fear that it started deleting my current packages.
{
"name": "tecnick.com/tcpdf",
"version": "6.2.11",
"homepage": "http://www.tcpdf.org/",
"type": "library",
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
"keywords": [
"PDF",
"tcpdf",
"PDFD32000-2008",
"qrcode",
"datamatrix",
"pdf417",
"barcodes"
],
"license": "LGPLv3",
"authors": [
{
"name": "Nicola Asuni",
"email": "info#tecnick.com",
"homepage": "http://nicolaasuni.tecnick.com"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"classmap": [
"fonts",
"config",
"include",
"tcpdf.php",
"tcpdf_parser.php",
"tcpdf_import.php",
"tcpdf_barcodes_1d.php",
"tcpdf_barcodes_2d.php",
"include/tcpdf_colors.php",
"include/tcpdf_filters.php",
"include/tcpdf_font_data.php",
"include/tcpdf_fonts.php",
"include/tcpdf_images.php",
"include/tcpdf_static.php",
"include/barcodes/datamatrix.php",
"include/barcodes/pdf417.php",
"include/barcodes/qrcode.php"
]
}
You can require many packages from the command line, for example:
composer require barryvdh/laravel-debugbar barryvdh/laravel-snappy fideloper/proxy
And all the packages will be required according to your composer specifications.
As a matter of fact, you can list all the packages separated by space, like so:
composer require aws/aws-sdk-php vimeo/vimeo-api phpoffice/phpexcel
Quote:
If you do not want to choose requirements interactively, you can pass
them to the command
From Composer documentation
Also consider --update-with-all-dependencies to update the dependencies of all newly installed packages.
If anyone else comes here and wants to know how to add "multiple" packages, simply use the Composer require command and run multiple CLI commands by terminating them with a semi-colon, e.g.
composer require drupal/pathauto;
composer require 'drupal/google_analytics:^3.0';
composer require 'doctrine/doctrine-bundle:2.*';
composer require 'monolog/monolog:~2.0.0';
Alternatively run with the --no-update flag to disable automatic update of dependencies and run all the updates together — composer will resolve dependencies in one hit:
composer require drupal/pathauto --no-update;
composer require 'drupal/google_analytics:^3.0' --no-update;
composer require 'doctrine/doctrine-bundle:2.*' --no-update;
composer require 'monolog/monolog:~2.0.0' --no-update;
composer update;
If you don't specify a version then composer will automatically pull the latest release. It's worth reading up on Composer versions and constraints, especially when it comes to updating packages. Check the Composer require command for more useful flags.
It can be useful to keep package requirements on separate lines as above, e.g. if you have a reference document of regularly installed packages, or if the commands are being generated by a build tool.
Alternatively you can run them all on one line:
composer require drupal/pathauto 'drupal/google_analytics:^3.0' 'doctrine/doctrine-bundle:2.*' 'monolog/monolog:~2.0.0';
N.B. Terminating commands with a semi-colon is a general solution for running multiple CLI commands, and not just composer specific, e.g.
composer self-update;
composer require 'drupal/google_analytics:^3.0';
cd app/build;
yarn run build;
To add "tecnick.com/tcpdf" to an existing composer.json file, on the commandline inside the directory containing it run:
composer require tecnick.com/tcpdf
You shouldn't have to manually edit the composer.json file for such things.
If you want to add handful of packages without having to wait tediously for composer to update after each and every one, but you prefer not to:
change a long series of modules together in a single line (poor readability, less convenient to reuse)
use a semi-colon delimited list of commands (featherbelly's answer - easy to insert a typo or accidentally paste a carriage return and screw it up midway through)
…then use the --no-update switch to have composer modify the composer.json file ONLY, without searching for packages.
You can run as few or as many as you want, use the CLI to do something else midway through, and when you're ready, just do composer-update by itself.
Here's an example of adding some Drupal modules for a new project:
composer require 'drupal/field_permissions:^1.0' --no-update
composer require 'drupal/coffee:^1.0' --no-update
composer require 'drupal/token:^1.5' --no-update
composer require 'drupal/field_tools:^1.0' --no-update
composer require 'drupal/required_by_role:^1.0' --no-update
composer require 'drupal/devel:^2.1' --no-update
composer require 'drupal/config_ignore:^2.1' --no-update
composer require 'drupal/ga_login:^1.0' --no-update
composer require 'drupal/tfa:^1.0' --no-update
composer require 'drupal/spambot:^1.0' --no-update
composer require 'drupal/pathauto:^1.4' --no-update
composer require 'drupal/flag:^4.0' --no-update
composer require 'drupal/stringoverrides:1.x-dev' --no-update
composer require 'drupal/structure_sync:^1.16' --no-update
composer require 'drupal/masquerade:^2.0' --no-update
composer require 'drupal/metatag:^1.8' --no-update
composer require 'drupal/unique_field_ajax:^1.2' --no-update
composer require 'drupal/config_override_warn:^1.2' --no-update
composer require 'drupal/environment_indicator:^3.6' --no-update
composer require 'drupal/role_delegation:^1.0' --no-update
composer require 'drupal/seo_checklist:^4.1' --no-update
composer update
NB: If you know what the modules you need and are typing your list manually anyway, just edit composer.json by hand - there's no point manually typing "composer require" over and over again.
However, the above method is handy for sites like Drupal where you're copying and pasting pre-written commands that contain complex version syntax for branches, individual commits etc.