Waheed Sindhani
Waheed Sindhani

Reputation: 91

Laravel Composer Development Packages

I've some packages for laravel which are needed only in development. When I create a new project I've to download all of them. Is there any way i can store them somehow or i can type a command and all packages are added to my project.

Upvotes: 0

Views: 141

Answers (2)

Mojtaba Taherzadeh
Mojtaba Taherzadeh

Reputation: 11

By default composer is per-project package and dependency manager that puts the packages in the vendor directory of the project but it seems that it allowed to install package globally with global command from COMPOSER_HOME directory like this :

php composer.phar global require friendsofphp/php-cs-fixer

for more information i recommend to see the following link from composer site : https://getcomposer.org/doc/03-cli.md#global

Upvotes: 1

Taha Paksu
Taha Paksu

Reputation: 15616

  1. You can create a default composer.json file, or just a part containing the required packages on production and development environments (require and require-dev sections), then just copy that section to your new project and run composer install.

  2. You can have a shell file init.sh containing the initialization code such as

    composer require vendor1/package1 vendor2/package2 vendor3/package3
    composer require vendor4/package4 vendor5/package5 vendor6/package6 --save-dev

and then copy that file inside the new project and run . init.sh or sh init.sh

If the required version is in your composer package cache, it won't be downloaded again, will be used from the cache. If there are any new versions, it'll download the updated package. (If you don't require a specific version while creating the above files)

Upvotes: 0

Related Questions