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 inside your project's directory.

By default, it will never install anything globally.

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

Useful links

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

Also, you can check your build log; it could be helpful for debugging.

  • Packanalyst: Packanalyst is a service that lets you browse packages from Packagist and shows who is using and implementing your interfaces / abstract classes/traits.
11065 questions
248
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
  • 3,780
  • 2
  • 20
  • 26
240
votes
5 answers

Composer: how can I install another dependency without updating old ones?

I have a project with a few dependencies and I'd like to install another one, but I'd like to keep the others the way they are. So I've edited the composer.json, but if I run composer install, I get the following output: Installing dependencies from…
duality_
  • 17,738
  • 23
  • 77
  • 95
228
votes
19 answers

Laravel PHP command not found

I installed Laravel using Composer without problems, but when I try to run laravel in the terminal, I get the following error: -bash: laravel: command not found The docs say that I need to do the following: Make sure to place the…
chemitaxis
  • 13,889
  • 17
  • 74
  • 125
222
votes
25 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
  • 9,420
  • 15
  • 65
  • 119
214
votes
5 answers

How to deploy correctly when using Composer's develop / production switch?

Composer has the option to load several dependencies only while being in development, so the tools will not be installed in production (on the live server). This is (in theory) very handy for scripts that only make sense in development, like tests,…
Sliq
  • 15,937
  • 27
  • 110
  • 143
209
votes
8 answers

How to require a fork with composer?

This 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,627
  • 2
  • 14
  • 9
194
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,604
  • 25
  • 75
  • 108
185
votes
20 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…
cherrycoding
  • 1,855
  • 2
  • 14
  • 19
181
votes
26 answers

Tell Composer to use Different PHP Version

I've been stuck at this for a few days. I'm using 1and1 hosting, and they have their PHP set up a bit weird. If I use just php composer.phar install, then I'm using PHP 4.4.6, which is horribly insufficient. However, I can run php5.5 composer.phar…
Boom
  • 2,465
  • 4
  • 19
  • 21
178
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
  • 15,582
  • 10
  • 47
  • 64
174
votes
4 answers

Composer require local package

I've got a couple of libraries [Foo and Bar] that I'm developing in concert, but are still technically separate things. Previously I've just re-defined the autoloader to like "Foo\\": "../Foo/src", but now that I've added a Guzzle dependency to Foo,…
Sammitch
  • 30,782
  • 7
  • 50
  • 77
159
votes
7 answers

How do I install Composer PHP packages without Composer?

I'm trying to install the Coinbase PHP API but it requires Composer: https://github.com/coinbase/coinbase-php I'm looking for a universal PHP solution (perhaps a function) to let me install composer packages directly onto my server, without having…
Amy Neville
  • 10,067
  • 13
  • 58
  • 94
157
votes
3 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
  • 10,985
  • 38
  • 91
  • 165
157
votes
17 answers

How can I resolve "Your requirements could not be resolved to an installable set of packages" error?

When I run composer update I receive some wired output. Here is my composer.json look like. { "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", …
code-8
  • 54,650
  • 106
  • 352
  • 604
156
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,694
  • 9
  • 53
  • 75