Does travis should install composer dev dependencies? - composer-php

I am wondering what are the travis composer arg recommendations ?
I can not find bests practices about it.
I set up the following: composer install --ansi --prefer-dist --no-interaction --optimize-autoloader --no-suggest --no-progress but should I add the --no-dev ?

Well, it really depends on whether you need them. Dev dependencies should be used for development purposes, running tests and so on. If you don't use them, there's no reason to keep them around.

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

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

Class 'BeyondCode\DumpServer\DumpServerServiceProvider' not found when I make composer install --optimize-autoloader --no-dev

I'm deploying my Laravel application and want to optimize the autoload, normally I would run the command
composer install --optimize-autoloader --no-dev
This is an application that runs Laravel 5.8. I am getting the following error:
In Application.php line 662:
Class 'BeyondCode\DumpServer\DumpServerServiceProvider' not found
Script #php artisan package:discover --ansi handling the
post-autoload-dump event returned with error code 1
If you do not have development dependencies on the laravel-dump-server, remove the following line from composer.json.
"beyondcode/laravel-dump-server": "^1.0".
Then run the following command.
composer install
Or, even easier, just run the following.
composer remove --dev beyondcode/laravel-dump-server
In my case I have done below steps
Delete vendor folder
Run: composer self-update --1
And again run: composer install
Then you can run any command you want
A detail around this issue has been written in one of the GitLab issues on
https://github.com/GoogleCloudPlatform/php-docs-samples/issues/736
This issue explain why this dev package creates problem on your build server.
For me, The issue resolved after I've added this in composer.json
{
"scripts": {
"gcp-build": [
"composer install --no-dev"
]
}
}
This will remove all the dev dependencies
I simply do
composer update
and then I redo again
like myself I run
php artisan migrate
Solution 1
composer install --optimize-autoloader --no-dev
if this not work try and getting error undefine index: Name
Solution 2
Step1: `composer self-update --1`
Step2: composer install
Bingo...!!!
You may need to run composer update with the --no-plugins option.
composer update --no-plugins

What does --prefer-dist mean when using create-project to install laravel4?

What does --prefer-dist mean when using create-project to install laravel4?
--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.

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

Resources