Composer not installing dependencies - composer-php

I installed the package mageplaza/module-smtp. It has the package mageplaza/module-core as requirement. (composer.json)
As I install the package with: composer require mageplaza/module-smtp it just installed that package and ignores the mageplaza/module-core dependency.
So I had to install it manually with: composer require mageplaza/module-core
Why do I need to install dependencies manually?

Related

Composer install VS composer install --dev

Is there any differences between "composer install" and "composer install --dev"?
I ran these two commands and get the same packages installed.
As you can read in the documentation, leaving it out and using --dev performs the same action:
--dev: Install packages listed in require-dev (this is the default behavior).

install composer No package php-cli available

i need to install composer in my server
i have this
No package php-cli available.
No package php-zip available.
Package wget-1.14-18.el7_6.1.x86_64 already installed and latest version
Package unzip-6.0-20.el7.x86_64 already installed and latest version
Nothing to do

How to find and treat the cause of an outdated composer package that is not in my composer.json?

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

composer: package can not be found on each environment

I was trying to install a composer package for Magento2 using composer require magestore/storelocator-magento2. In my local Vagrant box as well on my laptop the package could be found and was installed, whereas on a dev-server the same package could not be found.
My question is, which differences in the system setup or composer setup could be the reason, that an existing package cannot be found?
The composer.json and thus the stability settings are identical in all environments.
# machine 1
$ composer --version
Composer version 1.6.3 2018-01-31 16:28:17
$ composer require magestore/storelocator-magento2
Using version ^1.0 for magestore/storelocator-magento2
# machine 2
$ composer --version
Composer version 1.6.3 2018-01-31 16:28:17
$ composer require magestore/storelocator-magento2
[InvalidArgumentException]
Could not find a matching version of package magestore/storelocator-magento2.

Removing a package from composer's lockfile before install

Is it possible to remove a package and it's dependencies from composer's lockfile before install?
Things I've tried that don't work:
composer remove package --no-update # Only updates composer.json
composer remove package # Removes only this package, installs all its dependancies

Resources