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
4
votes
2 answers

Warning: Ambiguous class resolution Doctrine

After running composer update , I keep having the error below: Warning: Ambiguous class resolution, "Doctrine\ORM\Persisters\Entity\BasicEntityPersister" was found in both "$baseDir . …
Sirius
  • 653
  • 1
  • 14
  • 37
4
votes
1 answer

Symfony4 new bundle autoloading

I want to create a new reusable bundle with SF4. I followed the documentation but if I add my new bundle inside the "src" directory, there is a conflict with the App namespace and composer autoloading: "autoload": { "psr-4": { "App\\":…
pjehan
  • 820
  • 10
  • 18
4
votes
4 answers

Connection timeout error while updating composer on Digital Ocean

I am able to ssh into my droplet. Am also able to apt update and apt upgrade. When I try to run sudo composer self-update or composer update, I am getting connection timeout error. The "https://getcomposer.org/versions" file could not be downloaded:…
Donkarnash
  • 12,433
  • 5
  • 26
  • 37
4
votes
0 answers

requiring a different version of phpunit in composer based on php version installed

So I have a library that is supposed to work on PHP 5.3 - PHP 7.2. I'd like to have it unit tested on each of those versions on Travis CI but am running into a problem with PHPUnit. In my composer.json I have this (in…
neubert
  • 15,947
  • 24
  • 120
  • 212
4
votes
1 answer

How to resolve composer package circular dependency of external package?

See Github issue, where this question originated. My package is phpdocumentor/reflection-docblock, it's not a dependency. I'm trying to update phpdocumentor/reflection-docblock to newer phpunit/phpunit dependency, that started to use the package I…
Tomas Votruba
  • 23,240
  • 9
  • 79
  • 115
4
votes
3 answers

Laravel 5.5 throws ReflectionException CustomRequest Class doen't exist after upgrade from 5.4

I have recently upgraded Laravel to version 5.5 from 5.4, but whenever I send an API response to the server while updating or storing some information that uses custom requests, for example, book posts (BooksRequest), it throws an exception like the…
GingerN
  • 95
  • 1
  • 9
4
votes
1 answer

composer autoload file after classmaps are loaded

I have "autoload": { "psr-4": { "ACME": "src/", }, "classmap": ["src/"], "files": ["mapper.php"], "exclude-from-classmap": ["mapper.php"] }, in mapper.php I'm trying to give different namespaces for some…
Thellimist
  • 3,757
  • 5
  • 31
  • 49
4
votes
1 answer

Composer Fatal error: Cannot redeclare composerRequire

When running the PHP Development server on my MacOS I get the following error from composer. Fatal error: Cannot redeclare composerRequire01a3dc0b1f885ed2b645be37711584c1() (previously declared in…
Xenology
  • 2,357
  • 2
  • 21
  • 39
4
votes
1 answer

PHP Composer asking what program to open composer.phar file with

To test the Square SDK requires Composer. After I installed it (on Windows) and ran the command as mentioned in the installation instructions which is php composer.phar install (and realized that the PHP bit was the directory and not part of the…
John
  • 1
  • 13
  • 98
  • 177
4
votes
2 answers

PHP packages installed by Composer - should they be in source control?

I am reading/learning about Composer, the application-level package manager for PHP. In this blog post written by lead dev Jordi Boggiano, he writes: Composer on the other hand forces you to declare your project dependencies in a one-stop…
Callum
  • 435
  • 1
  • 4
  • 14
4
votes
1 answer

Using PSR4-Autoloading via Composer vs spl_autoload_register

We're building a new Slim application and we want to use PSR4-Autoloading with namespaces in our code. We found two ways to do that, via Composer i.e.: "autoload": { "psr-4": { "App\\Controller\\": "app/controllers", …
Naguib Ihab
  • 4,259
  • 7
  • 44
  • 80
4
votes
2 answers

How can I recreate composer.json from the content of the vendor directory?

I have a project where I am using composer. However, I have lost my composer.json. Is there a way to recreate composer.json from the content of the vendor directory?
Kush
  • 101
  • 1
  • 3
  • 14
4
votes
2 answers

Updating laravel to laravel 5.5 from laravel 5.4

I'm trying update a laravel from 5.4 version to 5.5. I have done everything with instruction from laravel guide: https://laravel.com/docs/master/upgrade When I'm trying use command: composer update the result is: Loading composer repositories…
Krzysztof Michalski
  • 791
  • 1
  • 9
  • 25
4
votes
1 answer

Composer autoload can't find class

I'm trying to create a MVC structure and use composer to autoload everything. But I keep getting this error: Fatal error: Uncaught Error: Class 'App\Init' not found in C:\wamp64\www\activity\Public\index.php on line 5 |MainFolder |App …
PlayHardGoPro
  • 2,791
  • 10
  • 51
  • 90
4
votes
2 answers

How to 'Uninstall' or 'Remove' plugin using composer?

I have installed some unnecessary plugins in my cakephp3 project, I want to remove/uninstall from my project, I'm not able to find any solutions. Will any suggest me what I do? How to 'Uninstall' plugin using composer, which installed by the…
Binary Brackets
  • 494
  • 1
  • 4
  • 12