2
votes

I am using apc user cache functions in my library package (https://packagist.org/packages/hazardland/db) but as you know:

Till PHP 5.5 there was estension ext_apc http://pecl.php.net/package/apc (user cache + opcache)

And from php 5.5 there is ext_apcu http://pecl.php.net/package/APCu which only implements user cache functions and not opcache.

So in my composer.json I need to require one of these two exstensions: ext_apc or ext_apcu whichever user has. Is it possible to setup such kind of extension dependency ?

If I require only ext_apc I am loosing php 5.5.x users but if I require only ext_apcu I am loosing php 5.4.x users.

Update after research:

So there are 2 directives in composer provide and replace but they cant help because I need that ext-apcu was provided by ext-apc and as ext-*-s are hardcoded virtual packages in composer, at least composer team needs to change them ? (I even can't find in virtual package list ext-apc or ext-apcu on packagist.org.)

1
Checked - no solution yet... : P - BIOHAZARD

1 Answers

1
votes

Loaded only ext-apcu extension and after:

composer show --platform

Returns this:

ext-apc 4.0.7 The apc PHP extension ext-apcu 4.0.7 The apcu PHP extension

So just require ext-apc deals with both cases.