Questions tagged [composer-php]

Composer is an application-level package manager for the PHP programming language. It provides a standard format for managing with ease PHP-based project dependencies (libraries) and was strongly inspired by Node.js's "npm" and Ruby's "bundler". Use with the [php] tag

Presentation

Composer is an application-level package manager.

Yes, it deals with "packages" or libraries, but it manages them on a per-project basis, installing them in a directory inside your project.

By default it will never install anything globally.

Thus, it is considered a PHP-based project package manager.

Useful links

  • Current documentation: The main source of documentation for the project.

  • Packagist: It is the main Composer repository.

    It aggregates all sorts of PHP packages that are installable with Composer.

  • The source code is available on GitHub and distributed under MIT license.

  • Composer as a service: copy/paste your composer.json and get the vendor.zip file of your dependencies.

    Also, you can check the log of your build; it could be useful for debug.

  • Packanalyst: Packanalyst is a service that lets you browse packages from Packagist and shows who is using and implementing your interfaces / abstract classes / traits.

10003 questions
185
votes
5 answers

What are the differences between composer update and composer install?

What are the differences between composer update and composer install?
Dawlatzai Ghousi
  • 2,965
  • 2
  • 15
  • 23
184
votes
28 answers

PHP Composer update "cannot allocate memory" error (using Laravel 4)

I just can't solve this one. I'm on Linode 1G RAM basic plan. Trying to install a package via Composer and it's not letting me. My memory limit is set to "-1" on PHP.ini Is there anything else I can do to get this installed? Loading composer…
ericbae
  • 9,378
  • 22
  • 73
  • 103
182
votes
8 answers

How to require a fork with composer

here is my composer.json, i want to use Nodge's fork of lessphp project on Github "repositories": [{ "type": "package", "package": { "version": "dev-master", "name": "nodge/lessphp", "source": { "url":…
Neilime
  • 2,277
  • 2
  • 12
  • 9
173
votes
17 answers

require(vendor/autoload.php): failed to open stream

I know that this issue has been posted many times, but for me it seems to be a different problem. Indeed, this error Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\site_web\send_mail.php…
adrTuIPKJ44
  • 1,883
  • 2
  • 7
  • 7
165
votes
13 answers

PHP error: "The zip extension and unzip command are both missing, skipping."

When I run a composer update I get this error message: Loading composer repositories with package information Updating dependencies (including require-dev) Failed to download psr/log from dist: The zip extension and unzip command are both…
b85411
  • 8,054
  • 10
  • 54
  • 109
149
votes
19 answers

Composer killed while updating

I got a problem, I tried to install a new package to my Laravel 4 project. But when I run php composer.phar update I get this: Loading composer repositories with package information Updating dependencies (including require-dev) Killed I have looked…
user3038158
  • 1,695
  • 2
  • 12
  • 15
142
votes
7 answers

Cannot create cache directory .. or directory is not writable. Proceeding without cache in Laravel

I created a new Laravel project. When I go to the terminal to install the dependecies composer displays the following warning: Cannot create cache directory /home/w3cert/.composer/cache/repo/https---packagist.org/, or directory is not writable.…
Karthik
  • 4,583
  • 12
  • 36
  • 65
141
votes
3 answers

Skip composer PHP requirement

We are using PHPCI and composer. The server which runs PHPCI is on PHP 5.3. For a project we added the Facebook PHP SDK, using composer. It requires PHP 5.4. Composer gets triggered by PHPCI and get executed. But because the CI server just got PHP…
Armin
  • 13,674
  • 9
  • 43
  • 60
139
votes
2 answers

composer discard changes: what do the [y,n,v,d,s,?] do

Simple question that's been bugging me for months. Occasionally I'll dive into the vendors directory to fix a bug (especially for our internal libs). After migrating and deploying the fix back to the source package, I'll composer update…
Mark Fox
  • 8,052
  • 9
  • 48
  • 72
134
votes
13 answers

Composer Warning: openssl extension is missing. How to enable in WAMP

Trying to install Composer dependency management tool on Win7/64 + WampServer 2.2 via the Setup Installer and I am getting the following message: The openssl extension is missing, which will reduce the security and stability of Composer. If…
sleeper
  • 3,307
  • 6
  • 28
  • 47
130
votes
2 answers

Composer require branch name

For example I want to require: { "repositories": [ { "type": "git", "url": "https://github.com/google/google-api-php-client.git" } ], "require": { "google/apiclient": "v1-master" } } In this example I try require…
Wizard
  • 9,737
  • 35
  • 78
  • 151
126
votes
3 answers

What does the tilde (~) mean in my composer.json file?

I have this line in my composer.json file: "require": { ... "friendsofsymfony/user-bundle": "~2.0@dev", ... }, What does the tilde ~ in ~2.0@dev exactly mean? Is that a placeholder and shall always fetch the subversions like 1.2.0,…
Gottlieb Notschnabel
  • 8,768
  • 17
  • 66
  • 107
124
votes
13 answers

You must enable the openssl extension to download files via https

I wanted to install Zend Framework 2. So I downloaded the skeleton application. As mentioned in the ZF2 manual, we have to issue the command php composer.phar install Inside the skeleton. But I'm getting an error You must enable the openssl…
Uttam Dutta
  • 4,850
  • 4
  • 16
  • 20
122
votes
5 answers

composer: How to find the exact version of a package?

Suppose I'm writing a library A, that depends on another library, monolog for instance. I want to install the latest version of monolog, so I just put this inside composer.json: { "require": { "monolog/monolog": "*.*.*" } } Then I…
HappyDeveloper
  • 11,489
  • 18
  • 76
  • 115
121
votes
8 answers

Use PHP composer to clone git repo

I'm trying to use composer to automatically clone a git repository from github that isn't in packagist but it's not working and I can't figure out what am I doing wrong. I think I have to include it among "repositories" like so: "repositories": [ …
martin
  • 76,615
  • 21
  • 156
  • 193