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
107
votes
9 answers

Composer loading from cache

I ran into a problem using composer for installing/uninstalling some dependencies in laravel, which come back after deleting them from composer.json and deleting their vendor folder. I initially used dflydev's markdown package, but now I want to…
Tarik
  • 2,151
  • 4
  • 19
  • 26
106
votes
3 answers

A non-empty PSR-4 prefix must end with a namespace separator

I'm trying to setup PSR-4 with Composer but I'm just getting A non-empty PSR-4 prefix must end with a namespace separator. My autoload in my composer.json looks like this: "autoload": { "psr-4": { "Acme\\models" : "app/models" …
Marwelln
  • 28,492
  • 21
  • 93
  • 117
104
votes
5 answers

How to show what requires a package in Composer

My Composer has just told me that a certain package foo/bar is abandoned. However, it's not listed in my composer.json, so therefore some other package has that as a dependency. How can I get Composer to show me this? For example, it might tell me…
joachim
  • 28,554
  • 13
  • 41
  • 44
104
votes
3 answers

How to specify Composer install path?

I have this definition: { "repositories": [ { "type": "package", "package": { "name": "symfony/sfGuardPlugin", "version": "4.0.2", "dist": { …
Tower
  • 98,741
  • 129
  • 357
  • 507
103
votes
11 answers

OSX -bash: composer: command not found

If i type "composer" i get the above error message. I did on my macbook: curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer to install Composer globally. I had to manually create the /local/bin/composer…
bobbybackblech
  • 1,868
  • 5
  • 20
  • 22
99
votes
6 answers

Running composer in a different directory than current

I don't know if this question has been asked, because searching finds results mostly about moving the libraries installation directory. I have a globally installed composer command. Is there a way to run, for example, composer install in a different…
Przemek
  • 6,300
  • 12
  • 44
  • 61
96
votes
10 answers

Composer: Command Not Found

From within the directory holding my composer.phar file, I can't execute any composer commands. I can see Composer is running when I execute php composer.phar But any direct composer statements fail. Not sure if it matters but Composer was…
Brandon Buster
  • 1,195
  • 1
  • 9
  • 12
95
votes
8 answers

Where to find composer's global packages?

For a plugin for Sublime Text I was required to install a composer package globally. In order to do this I had to run the following command: composer global require "asm89/twig-lint" "@stable" The installation started running and a few seconds…
Peter
  • 8,776
  • 6
  • 62
  • 95
94
votes
17 answers

How to change PHP version used by composer

I want to use another php version on my machine than the one already installed using WAMP (2 PHP version installed). The composer installed uses PHP 5.6 A new project requires PHP7.0. Whenever I choose PHP 7 from the control panel of WAMP and…
Blues Clues
  • 1,694
  • 3
  • 31
  • 72
94
votes
11 answers

Unable to self-update Composer

I am trying to update Composer without any luck! What I have tried: $ composer self-update [InvalidArgumentException] Command "self-update" is not defined. $ sudo -H composer self-update [InvalidArgumentException] Command "self-update" is not…
Waqleh
  • 9,741
  • 8
  • 65
  • 103
93
votes
5 answers

How to update Composer in Windows 10

I am using Composer for my PHP project. I am new to Composer. Now when I update my dependencies using composer update command, it is saying that my Composer version is too old and ask me to update. So I tried as below. But all failed. My…
Wai Yan Hein
  • 13,651
  • 35
  • 180
  • 372
93
votes
5 answers

Is there a way to uninstall dev dependencies with composer?

I want to uninstall (and not remove from my composer.json) dev dependencies on a project. Is there a simple way to do this ?
Yohan G.
  • 1,176
  • 1
  • 7
  • 7
92
votes
3 answers

Get the list of outdated Composer packages

I want to get list of outdated packages that will be updated when I issue composer update. Does composer have such functionality? if no is there a way to do that (with or without composer?)
Stefano Mtangoo
  • 6,017
  • 6
  • 47
  • 93
89
votes
17 answers

Laravel throws 'The bootstrap/cache directory must be present and writable' error after update

I used 'composer update', which updated a few packages. During the updating process the website still functions. However, after it says 'The compiled services file has been removed', the website doesn't load and instead says: Exception in…
Peter Bennink
  • 893
  • 1
  • 6
  • 4
88
votes
12 answers

install ext-zip for Mac

I am trying to run composer update and I get the following errors: Problem 1 - The requested PHP extension ext-zip * is missing from your system. Install or enable PHP's zip extension. Problem 2 - maatwebsite/excel 3.1.10 requires…
Abdul
  • 1,537
  • 2
  • 13
  • 22