Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change default vendor name for "composer init" command

Tags:

composer-php

I have an issue when I create a new composer package.
For instance when I start creating the package, I create an empty folder and then I run composer init.

Then, Composer propose me already a default value for the Package name.
In this case:

Package name (<vendor>/<name>) [namesurname/testdirectory]

But since in Github my username has a - in between. I need to change my vendor name from namesurname to name-surname.

I'm checking on the composer documentation if there is a setting in the composer configuration to change the vendor name but I cannot find anything about.

How can I change it?

like image 683
Davide Casiraghi Avatar asked Mar 11 '19 08:03

Davide Casiraghi


1 Answers

You may use COMPOSER_DEFAULT_VENDOR environment variable to set default vendor name:

export COMPOSER_DEFAULT_VENDOR=name-surname
composer init

You may add export COMPOSER_DEFAULT_VENDOR=name-surname to your .bashrc to make it permanent.

AFAIK it is undocumented, but it was implemented in this PR.

like image 122
rob006 Avatar answered Oct 23 '22 01:10

rob006