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
661
votes
17 answers

How can I remove a package from Laravel using PHP Composer?

What is the correct way to remove a package from Laravel using PHP Composer? So far I've tried: Remove declaration from file composer.json (in the "require" section) Remove any class aliases from file app.php Remove any references to the package…
igaster
  • 12,983
  • 6
  • 26
  • 27
641
votes
7 answers

How to install a specific version of package using Composer?

I am trying to install a specific version of a package using Composer. I tried composer install and composer require but they are installing the latest version of the package. What if I want an older version?
gdaras
  • 9,401
  • 2
  • 23
  • 39
628
votes
10 answers

Should composer.lock be committed to version control?

I'm a little confused with composer.lock used in an application with a repository. I saw many people saying that we should not .gitignore composer.lock from the repository. If I update my libraries in my dev environment, I will have a new…
Pierre de LESPINAY
  • 44,700
  • 57
  • 210
  • 307
456
votes
8 answers

How to update a single library with Composer?

I need to install only 1 package for my SF2 distribution (DoctrineFixtures). When I run php composer.phar update I get - Updating twig/twig (dev-master 39d94fa => v1.13.0) The package has modified files: M CHANGELOG M…
Tool
  • 12,126
  • 15
  • 70
  • 120
400
votes
30 answers

Laravel 5 Failed opening required bootstrap/../vendor/autoload.php

I have recently installed Laravel 5 via Composer. I tried creating a new controller using Artisan and got the following error. Am I missing something? bootstrap/../vendor/autoload.php. Failed to open stream: No such file or directory. The "vendor"…
Scott
  • 5,074
  • 3
  • 16
  • 13
380
votes
24 answers

Composer require runs out of memory. PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted

I am trying to add HWIOAuthBundle to my project by running the below command. composer require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle HWIOAuthBundle github: https://github.com/hwi/HWIOAuthBundle When I try to run composer…
Brian Chen
  • 4,001
  • 3
  • 9
  • 15
370
votes
9 answers

How to get list of all installed packages along with version in composer?

I have been working on a project using Symfony 2.1 on my local machine. I have uploaded it to my server but when I try and install the vendor bundles using Composer, I'm getting a lot of dependency errors. Presumably this is something to do with…
Dan
  • 6,265
  • 8
  • 40
  • 56
324
votes
4 answers

PHP7 : install ext-dom issue

I'm running laravel 5.4 on Ubuntu 16.04 server with PHP7. trying to install cviebrock/eloquent-sluggable package throw some error: pish@let:/home/sherk/ftp/www$ sudo composer require cviebrock/eloquent-sluggable Do not run Composer as root/super…
alex
  • 7,551
  • 13
  • 48
  • 80
324
votes
15 answers

Laravel 5 - artisan seed [ReflectionException] Class SongsTableSeeder does not exist

When I run php artisan db:seed I am getting the following error: [ReflectionException] Class SongsTableSeeder does not exist What is going on? My DatabaseSeeder class:
Sasha
  • 8,521
  • 23
  • 91
  • 174
273
votes
4 answers

How to remove unused dependencies from composer?

I installed a package with composer, and it installed many other packages as dependencies. Now I uninstalled the main package with composer remove packageauthor/packagename, but all the old dependencies were not removed. I expected composer to clean…
Lorenz Meyer
  • 19,166
  • 22
  • 75
  • 121
271
votes
18 answers

Composer install error - requires ext_curl when it's actually enabled

I'm trying to install Facebook PHP SDK with Composer. This is what I get $ composer install Loading composer repositories with package information Installing dependencies (including require-dev) Your requirements could not be resolved to an…
Michal Artazov
  • 4,368
  • 8
  • 25
  • 38
266
votes
3 answers

What's the difference between require and require-dev?

I would like to know the difference between require and require-dev. The composer website doesn't offer a good explanation the difference between these two. The part that I don't get is Lists packages required for developing this package, or running…
slier
  • 6,511
  • 6
  • 36
  • 55
265
votes
5 answers

What Are the Differences Between PSR-0 and PSR-4?

Recently I've read about namespaces and how they are beneficial. I'm currently creating a project in Laravel and trying to move from class map autoloading to namespacing. However, I can't seem to grasp what the actual difference is between PSR-0 and…
Varun Nath
  • 5,570
  • 3
  • 23
  • 39
264
votes
19 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
  • 2,793
  • 2
  • 9
  • 8
257
votes
41 answers

Running Composer returns: "Could not open input file: composer.phar"

I am new to symfony2 and reading symblog. In third chapter while trying with data-fixtures I tried the command: php composer.phar update but I got the error: Could not open input file: composer.phar So I googled a little and tried php…
user3291745
  • 2,629
  • 2
  • 12
  • 8
1
2 3
99 100