Issue when install package with composer v1 [closed]

1 day ago 2
ARTICLE AD BOX

Working with old PHP 7.2 and Composer v1 in 2026 is definitely a challenge - those dependency issues can drive you crazy. Let me help you sort this out.

The real issue here

That error message you're seeing is a bit misleading. The package spomky-labs/otphp definitely exists (it's a solid library for MFA), but the version you tried (^9.0) isn't playing nice with your Composer v1 setup. The good news? There's a version that works perfectly with PHP 7.2.

Here's what you need to do

You should install version 10.0 instead. According to the official documentation, v10.0 requires PHP 7.2 or higher, which is exactly what you're running (https://github.com/Spomky-Labs/otphp/blob/v10.0/doc/index.md)

Please Run this command:

composer require spomky-labs/otphp:^10.0

The ^10.0 tells Composer to grab the latest 10.x release. I found the actual composer.json from the library itself, and it confirms that v10.0 supports PHP ^7.2|^8.0 .

Once it's installed, here's a simple way to use it (based on the official docs: https://github.com/Spomky-Labs/otphp/blob/v10.0/doc/index.md)

<?php require_once 'vendor/autoload.php'; use OTPHP\TOTP; // Create a new TOTP object $totp = TOTP::create(); $secret = $totp->getSecret(); echo "Your secret key: " . $secret . "\n"; // Get current OTP code echo "Current OTP: " . $totp->now() . "\n"; // Verify a code (useful for when user submits their code) $userCode = $totp->now(); // In reality, this would come from user input if ($totp->verify($userCode)) { echo "Code is valid!\n"; } else { echo "Invalid code\n"; }
Read Entire Article