Composer install VS composer install --dev - composer-php

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).

Related

composer install --dev is gone, how do I use dev dependencies?

Most people in my team doesn't need dev dependencies. So it is desirable that composer install doesn't install dev dependencies.
However, QA does need to install them with some command.
I have no idea how to achieve this now. Formerly it was composer install --dev but that's gone.
You can set the environment variable COMPOSER_NO_DEV to 0 or 1 to change the default behaviour of composer install and composer update.
see: documentation - COMPOSER_NO_DEV
If you want composer install to not install the dev dependencies by default
export COMPOSER_NO_DEV=1
If you want composer install to install dev dependencies (the default)
export COMPOSER_NO_DEV=0
or unset COMPOSER_NO_DEV
Depending on how you develop (i.e. in a container) there are various options to set a default value for the environment variable.
On the other hand you can instruct your engineer colleagues that do not require any dev dependencies to run the command:
composer install --no-dev
# .. or ..
COMPOSER_NO_DEV=1 composer install
... instead of ...
composer install
# .. or ..
COMPOSER_NO_DEV=0 composer install

how to install illuminate/mail via composer in Lumen

A setting mail-in on lumen project, I should install illuminate\mail via composer, but show me an error:
Your requirements could not be resolved to an installable set of packages
You can install through composer using the following command in the terminal:
composer require illuminate/mail
Make sure you are in the project directory.

How do I do updates for my laravel project?

What command can I use to see a list of all my installed packages and do the update ? (through the terminal)
If you have composer run in the console
composer show --installed
For updating all your dependencies run in the console
composer update
To show installed packages run: composer show --installed
To update installed packages run: composer update
And Read these documents this and this

What does the different flags of Composer when creating a Laravel project?

Anyone can tell me the difference between this commands
composer create-project laravel/laravel your-project-name --prefer-dist
composer create-project laravel/laravel your-project-name
composer create-project laravel/laravel your-project-name -dev
From the documentation for composer:
--prefer-dist: Reverse of --prefer-source, composer will install from dist if possible. This can speed up installs substantially on build servers and other use cases where you typically do not run updates of the vendors. It is also a way to circumvent problems with git if you do not have a proper setup.
That means Composer will install the dependencies from the distribution build, instead of the sources.
And for the --dev flag:
--dev: Install packages listed in require-dev.
That means Composer will also install all package dependencies list in require-dev key from your composer.json. The require-dev key are dependences only required for development.
Please, for more information, read the docs regarding Composer CLI: https://getcomposer.org/doc/03-cli.md#create-project

Swiftmailer Error Composer Install

i am installing composer dependencies by 'composer install'.
it download bunch of packages but after swiftmailer it gives me error
[UnexpectedValueException]
'C:\Users\DELL\Downloads\laravel-4\vendor/swiftmailer/swiftmailer/72e34d......54c82f.1' is not a zip archive.
what does it mean?
For me this problem happened due to the order composer was installing the files.
The work around that worked for me was to go into \vendor\composer\autoload_real.php and comment out the following line
require $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php';
and then run composer again
Running composer install with the --prefer-source option, fixed this problem for me.

Resources