composer: PEAR Repositories do not work in 2.0

While checking the docs about naming, I also found the following thing:

https://github.com/composer/composer/blob/be1ddcf29356cea48c87ff8a8d670311f3d78a38/doc/05-repositories.md#pear

PEAR repositories also do not work in 2.0:

Running composer in a directory with the composer.json from the docs example, gives the following:

$ ../bin/composer install

                                                                                                                                                                     
  [RuntimeException]                                                                                                                                                 
  require.pear-pear2.php.net/PEAR2_Text_Markdown is invalid, it should not contain uppercase characters. Please use pear-pear2.php.net/pear2_text_markdown instead.  
                                                                                                                                                                     

$ ../bin/composer --version

                                                                                                                                                                     
  [RuntimeException]                                                                                                                                                 
  require.pear-pear2.php.net/PEAR2_Text_Markdown is invalid, it should not contain uppercase characters. Please use pear-pear2.php.net/pear2_text_markdown instead.  
                                                                                                                                                                     

Renaming the package to lowercase:

$ ../bin/composer install
The "wikimedia/composer-merge-plugin" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
The "fxp/composer-asset-plugin" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.
Loading composer repositories with package information
Updating dependencies
Initializing PEAR repository https://pear2.php.net
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires pear-pear2.php.net/pear2_text_markdown, it could not be found in any version, there may be a typo in the package name.
  Problem 2
    - Root composer.json requires pear-pear2/pear2_http_request, it could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
You are using a snapshot build of Composer 2, which may be the cause of the problem. Run `composer self-update --stable` and then try again. In case it solves the problem, please report an issue mentioning Composer 2.

Maybe the strict naming restriction should be limited to native composer ecosystem and not be applied to fetch packages from external sources?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

FWIW next major versions of all Horde libraries and applications will be composer-only too.

TBH I wonder if anyone still uses this… Maybe should be soft-deleted in v2 until/unless someone complains. I’ll have a look at that. Just ignore for now.

@Seldaek https://dev.horde.org/imap_client/install.php would be one example of a large, well known, PHP lib distributing via pear repository. Usage may be increasing given php-imap extension is dead, lacking oauth support and looming deadlines from Google+Microsoft forcing a switchover to OAuth only authentication which php-imap does not support.

https://lists.horde.org/mailman/listinfo/dev is the place where things are being discussed mostly, with references to the relevant repos and PRs.

Yeah I don’t think we’re going to bring back pear support because of one project. PEAR isn’t shipping with PHP anymore, it’s really about time people move on.

you need to download it with composer 2 first, to make it appear in the composer 1 metadata of packagist.org

Yeah @yunosh happy to help. Is there a place we can coordinate?

@bytestream maybe create a patch to composer 1.x to lowercase package names (in all occurrences) in pear support, and satis option to use it?

or just post-process your json files with sed:

sed -i -e 's/Horde_Imap_Client/horde_imap_client/g' *.json

this is not verified, maybe there are some integrity checksums which such editing breaks.