I tried to install this package: https://github.com/reactphp/filesystem
from composer 2.0.13 using this command:
composer require react/filesystem:^0.1.2
Which is the latest current version of this GitHub package.
But for some reason the files content that I'm getting is far different than the one on GitHub , It lacks lots of functions.
It makes me wondered if any of my other composer packages are truely updated..
As for right now I clone it manualy but what makes composer clone a diffrent files?
I tired clearing cache, re-Install, ignore platform requirements and update both composer and packages.
You required a stable version of this package, and got the v0.1.2. Composer package versions usually correspond to Git tags. If you look at the repository tags, you can see that v0.1.2 is commit 766cdef from 27 Oct 2018.
On the repository front page you see the code in its latest version (last commit of main branch), which actually is fc89dc2 committed on 8 May 2020.
The missing code you are talking about probably isn't released yet and may be unstable.
If you still want to install the latest version (there are good reasons for that), change the minimum-stability of your composer.json to dev and require the dev-master version of the package.
Related
I'm working on a project based on PHP7 and Laravel. Unfortunately, there was a problem with dependencies and package versions.
I guessed that the previous developer working on the project started updating packages by calling
composer update
on his local dev environment.
Therefore, a new composer.lock file has been generated and everything has been pushed to the production server - however, the composer update command has not been called on the production...
There is a problem with the incompatibility of the PHP version and other errors in dependencies.
This is a very large project and I wouldn't like to migrate now to higher versions on the production server.
I am currently preparing a development environment and I care about maintaining the maximum compatibility of all package versions with what is on production.
By calling:
composer install
on local environment, I'm receiving a series of errors related to the incompatibility of the package versions.
Is there any way to regenerate / restore composer.json and composer.lock based on what is currently installed on the production server? Unfortunately, at this moment composer.lock on production doesn't completely reflect the current state of actually installed versions.
What is a safe and good way to recreate locally a cloned project from a repository on a production server - and maintain full compatibility of all package versions, the correct form of composer.json and composer.lock?
Thanks in advance for your help!
To run composer update and composer install
You can run with this code
composer install --ignore-platform-reqs
Or for update
composer update --ignore-platform-reqs
I found https://www.wuhaiqiao.com/2020/11/24/329.html
No, there is no way to recreate composer.json file based on what is already installed in /vendor. You can look for /vendor/composer/installed.json file as a reference for installed versions of all packages.
What you need to do in this case is:
Make sure your local environment is exactly the same as your production one. You can fake it if needed in your composer.json too by using platform configuration.
Your composer.lock file is of no use. Get /vendor/composer/installed.json file from your production. Delete your /vendor folder.
Run composer install. Write down all packages that have issues and check provided solutions by Composer.
Start downgrading the versions in your composer.json for packages that have issues based to the solutions provided by Composer. Be sure to look into those packages yourself - developers aren't always very strict with the way they maintain dependencies and versioning of their packages. You can always just take package version from production's /vendor/composer/installed.json and place that specific version in your composer.json.
Repeat steps 3-4 until you can finally generate new composer.lock file. Make sure your composer.json and composer.lock files are tracked by your VCS and fixate the changes.
Well, after running command composer outdated I can see there's newer version of phpdocumentor/type-resolver available. Installed version is 0.2.1 and the latest one is 0.3.0. Need to say that it was indirectly installed by component I use and not by me.
Problem is when I run composer update or composer update phpdocumentor/type-resolver it says "Nothing to install or update". Why and how to fix?
probably some dependency have fixed the package release you want to install. Try so the the output of the command to check who are using and at which version the package you listed:
composer why-not phpdocumentor/type-resolver 0.3.0
NB: in the current version of the documentation of composer the command is named prohibits, so in case this doesn't work try with:
composer prohibits phpdocumentor/type-resolver 0.3.0
Hope this help
You might have version constraints blocking the upgrade in your composer.json file. This is intended to prevent adding in breaking changes. In your example, the versions are pre-release (0.*), so versioning constraints even act on the miner version.
If you are confident there are no breaking changes or you are prepared to deal with them, edit your composer.json file. Change something like:
"phpdocumentor/type-resolver": "0.2.1",
to
"phpdocumentor/type-resolver": "^0.3",
Try composer upgrade again and test it out to make sure everything is ok.
Does anyone know if Wordpress Roots Bedrock Composer updates the Wordpress version? I have tried composer update but it doesn't update the Wordpress version. Any help will be highly appreciated.
Thanks,
Danish.
Wordpress is treated as a required dependency by composer, so yes. It is updated when you run composer update.
You can check if your composer packages are outdated with: composer outdated (or composer show -l). Each package will be listed showing the desired version (the version number specified in composer.json) and the current released version.
Running composer update, (or composer.phar update) will update each package to your specified version. If you want to update the package to the latest version, but you're unaware of the current version number. You can remove the package, and then add it back in. Composer will add the package to your required dependency list with the latest version.
I want to get list of outdated packages that will be updated when I issue composer update. Does composer have such functionality? if no is there a way to do that (with or without composer?)
Update:
Since Composer v1.1 (May 2016) the following commands are available:
composer outdated shows you the list of outdated packages
composer show -l returns the complete list of packages. packages in need of update are colored red. the (still) up-2-date ones are colored green.
both commands accept the parameter --direct to show only direct dependencies in the listing
Referencing:
https://github.com/composer/composer/issues/3771
Composer Plugins
There are some Composer Plugins showing the list of outdated packages:
composer-versions-check - https://github.com/Soullivaneuh/composer-versions-check
The Composer Plugin called "composer-versions-check" shows outdated packages from last major versions after using the update command. (Latest is ..)
This plugin runs "update" first, then shows possible "upgrade" indications.
A Composer dry-run isn't supported, yet.
vinkla/climb - https://github.com/vinkla/climb
Climb is a "Composer version manager tool" inspired by npm-check-updates.
It shows the outdates package version and indicates "upgrades" to latest versions.
Since version 1.1 of Composer there is the composer outdated command. With composer outdated --direct only your direct dependencies are taken into account.
To complete #jens-a-koch response, get any dependency update:
composer outdated
or get only direct dependencies from your composer.json:
composer outdated -D
https://getcomposer.org/doc/03-cli.md#outdated
outdated
The outdated command shows a list of installed packages that have
updates available, including their current and latest versions. This
is basically an alias for composer show -lo.
The color coding is as such:
green (=): Dependency is in the latest version and is up to date.
yellow (~): Dependency has a new version available that includes backwards compatibility breaks according to semver, so upgrade when you can but it may involve work.
red (!): Dependency has a new version that is semver-compatible and you should upgrade it.
Options
--all (-a): Show all packages, not just outdated (alias for composer show -l).
--direct (-D): Restricts the list of packages to your direct dependencies.
--strict: Returns non-zero exit code if any package is outdated.
--minor-only (-m): Only shows packages that have minor SemVer-compatible updates.
--format (-f): Lets you pick between text (default) or json output format.
I want to get list of outdated packages that will be updated when I issue composer update. Does composer have such functionality? if no is there a way to do that (with or without composer?)
Update:
Since Composer v1.1 (May 2016) the following commands are available:
composer outdated shows you the list of outdated packages
composer show -l returns the complete list of packages. packages in need of update are colored red. the (still) up-2-date ones are colored green.
both commands accept the parameter --direct to show only direct dependencies in the listing
Referencing:
https://github.com/composer/composer/issues/3771
Composer Plugins
There are some Composer Plugins showing the list of outdated packages:
composer-versions-check - https://github.com/Soullivaneuh/composer-versions-check
The Composer Plugin called "composer-versions-check" shows outdated packages from last major versions after using the update command. (Latest is ..)
This plugin runs "update" first, then shows possible "upgrade" indications.
A Composer dry-run isn't supported, yet.
vinkla/climb - https://github.com/vinkla/climb
Climb is a "Composer version manager tool" inspired by npm-check-updates.
It shows the outdates package version and indicates "upgrades" to latest versions.
Since version 1.1 of Composer there is the composer outdated command. With composer outdated --direct only your direct dependencies are taken into account.
To complete #jens-a-koch response, get any dependency update:
composer outdated
or get only direct dependencies from your composer.json:
composer outdated -D
https://getcomposer.org/doc/03-cli.md#outdated
outdated
The outdated command shows a list of installed packages that have
updates available, including their current and latest versions. This
is basically an alias for composer show -lo.
The color coding is as such:
green (=): Dependency is in the latest version and is up to date.
yellow (~): Dependency has a new version available that includes backwards compatibility breaks according to semver, so upgrade when you can but it may involve work.
red (!): Dependency has a new version that is semver-compatible and you should upgrade it.
Options
--all (-a): Show all packages, not just outdated (alias for composer show -l).
--direct (-D): Restricts the list of packages to your direct dependencies.
--strict: Returns non-zero exit code if any package is outdated.
--minor-only (-m): Only shows packages that have minor SemVer-compatible updates.
--format (-f): Lets you pick between text (default) or json output format.