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

Using Composer's Autoload

I have been looking around the net with no luck on this issue. I am using composer's autoload with this code in my composer.json: "autoload": { "psr-0": {"AppName": "src/"} } But I need to autoload at a higher level than the vendor…
Chris R
  • 1,263
  • 2
  • 10
  • 14
71
votes
6 answers

laravel composer update : the requested PHP extension dom is missing from your system

I am using ubuntu 16.04, laravel 5.2 when i run update composer in my project directory its showing "the requested PHP extension dom is missing from your system" i checked installed packages of PHP, its available there
Vivek Chaudhari
  • 1,930
  • 1
  • 14
  • 20
69
votes
5 answers

How to install Laravel 5.0

I'm having trouble getting a test instance of Laravel 5.0 up and running so I can assist with this transition. 1) Creating a new app from https://github.com/laravel/laravel/tree/develop leads to the following error when running composer…
Ben
  • 60,438
  • 111
  • 314
  • 488
69
votes
5 answers

Autoloading classes in PHPUnit using Composer and autoload.php

I have just installed PHPUnit version 3.7.19 by Sebastian Bergmann via Composer and have written a class I would like to unit test. I would like to have all my classes autoloaded into each unit test without having to use include or require at the…
Jasdeep Khalsa
  • 6,740
  • 8
  • 38
  • 58
69
votes
5 answers

Why updating of dependencies in composer is so slow?

I am using composer (http://getcomposer.org/) to manage installed bundles in the Symfony2 (symfony v 2.1.3). Version of the composer is de3188c. I have problem that when I add new bundle into the composer.json and execute it the time to show…
Myth Rush
  • 1,088
  • 1
  • 9
  • 19
68
votes
18 answers

CakePHP 3.0 installation: intl extension missing from system

Using the CakePHP docs, I am trying to install 3.0-beta2 using composer but I got this error: cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system However, I know for sure that intl is…
Juan Carlos
  • 1,073
  • 1
  • 9
  • 13
67
votes
2 answers

Composer/PSR - How to autoload functions?

How can I autoload helper functions (outside of any class)? Can I specify in composer.json some kind of bootstrap file that should be loaded first?
mpen
  • 272,448
  • 266
  • 850
  • 1,236
67
votes
3 answers

Install dependency (doctrine/dbal) on composer laravel

I am trying to execute a migration to rename some columns and I got an exception. As I read on the documentation I have to add the doctrine/dbal dependency to my composer.json file. How do I do that? Which is the correct composer.json file. I have…
elvainch
  • 1,369
  • 3
  • 15
  • 32
66
votes
15 answers

"The requested PHP extension bcmath is missing from your system."

Greetings fellow developers, I am trying to use composer for a PHP project of mine on a development server I recently booted up and for some reason I am unable to. I successfully installed composer, however, when I try to run the require command I…
Coelho
  • 661
  • 1
  • 5
  • 3
65
votes
8 answers

RuntimeException vendor does not exist and could not be created

I've tried other posts I found online but none seemed to work correctly. I'm working with this. And I make my way to the root of it, which is /var/www/. So then I do composer install and I have a composer.json file in there. I get…
user3413366
  • 653
  • 1
  • 5
  • 7
63
votes
8 answers

Errors installing Composer on macOS (JIT compilation failed)

When I run composer --version in the macOS terminal, I get the following errors. PHP Warning: preg_match(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 755 Warning:…
sheraz m
  • 666
  • 1
  • 5
  • 7
63
votes
15 answers

Composer hanging while updating dependencies

I tried updating a Laravel project I'm working on today using composer update But it hung on Updating dependencies (including require-dev) So I tried things like updating composer, dump-autoload, but nothing seemed to work. Then I ran it in verbose…
Chris
  • 4,277
  • 7
  • 40
  • 55
63
votes
3 answers

Difference between composer prefer-dist and prefer-source?

Looking at the help for PHP Composer's install command, I see the following two options $ composer help install Options: --prefer-source Forces installation from package sources when possible, including VCS information. --prefer-dist …
Alana Storm
  • 164,128
  • 91
  • 395
  • 599
62
votes
7 answers

Composer list packages with installed version and latest version

As in the title, is there any command that can list installed packages and the latest version of those packages together? edit: php composer.phar show this show all available packages and also installed packages with installed version only php…
Laz
  • 629
  • 1
  • 5
  • 4
62
votes
8 answers

How to develop and include a Composer package?

I'm looking to develop a package in PHP, but I don't want it immediately available on GitHub or somewhere. It's easy enough to include a Packagist file in my composer.json, but how do I add a local package into my composer.json? Also, should I be…
greggilbert
  • 1,313
  • 2
  • 13
  • 26