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
156
votes
6 answers

What is the difference between require and require-dev sections in composer.json?

I'm beginning using composer, I know so little about it and have a little experience with web application development. I just walk through Nettuts+ Tutorial, so I have basic question about composer. { "require": { "laravel/framework":…
Artisan
  • 4,042
  • 13
  • 37
  • 61
156
votes
8 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
  • 12,480
  • 22
  • 82
  • 117
154
votes
22 answers

Composer update memory limit

I need to run composer update at my hosting so I log in with ssh and try to run the following command inside /www folder where I have Laravel and composer installation: composer update I get this error: I'm in contact with my hosting provider,…
Andrew
  • 2,128
  • 3
  • 24
  • 42
153
votes
29 answers

Laravel showing "Failed to clear cache. Make sure you have the appropriate permissions"

Laravel was displaying to me "Access denied for user 'homestead'@'localhost' (using password: YES)". One solution for this was clearing the cache and the config cache stored, all this with these three commands: php artisan cache:clear php artisan…
E.Akio
  • 2,249
  • 3
  • 14
  • 27
150
votes
4 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
  • 5,589
  • 18
  • 46
  • 78
146
votes
11 answers

How to force composer to reinstall a library?

I'm using the ZF2 skeleton app and it has a .gitignore that prevents external libraries from being commited to git. While debugging I like to go and change stuff here and there in the libraries' source to learn how things work. If these were version…
Julian
  • 8,808
  • 8
  • 51
  • 90
142
votes
1 answer

Error "Root composer.json requires php ^7.3 but your php version (8.0.0) does not satisfy that requirement"

I have an unusual error while running the composer install command. It requires PHP 7.3 while I have PHP 8.0.0. This question is different from Override PHP base dependency in composer, because I have a higher version of PHP (8.0.0) than it…
NIKHIL NEDIYODATH
  • 2,703
  • 5
  • 24
  • 30
140
votes
14 answers

Can't install package via composer: PHP extension zip is missing

I'm trying to install laravel installer with the composer on my Ubuntu PC, but I get this error during the installation. `Your requirements could not be resolved to an installable set of packages. Problem 1 - laravel/installer v1.4.1 requires…
Andreas Sauer
  • 1,407
  • 2
  • 8
  • 6
140
votes
9 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
  • 93,354
  • 25
  • 191
  • 226
137
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,446
  • 7
  • 33
  • 50
134
votes
7 answers

How to downgrade or install a specific version of Composer?

I'm getting the following error in a project I'm setting up: You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2. I've…
Bash
  • 1,512
  • 2
  • 11
  • 12
133
votes
4 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
  • 9,408
  • 18
  • 74
  • 116
132
votes
3 answers

How to correctly require a specific commit in Composer so that it would be available for dependent packages?

I have a library foo/foo-lib which requires a specific commit from GitHub: { "name": "foo/foo-lib", "repositories": [ { "type": "vcs", "url": "https://github.com/KnpLabs/Gaufrette.git" } ], …
Maciej Sz
  • 11,151
  • 7
  • 40
  • 56
127
votes
14 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
  • 5,250
  • 4
  • 18
  • 21
125
votes
14 answers

The openssl extension is required for SSL/TLS protection

composer create-project flarum/flarum . --stability=beta I try to run this command, but it gave me this error. [RuntimeException] The openssl extension is required for SSL/TLS…
Mike Yang
  • 2,581
  • 3
  • 24
  • 27