bulldog / yubico
PHP Package for Yubico authentication
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
pkg:composer/bulldog/yubico
Requires
- guzzlehttp/guzzle: ~6.0
This package is auto-updated.
Last update: 2025-10-05 21:37:53 UTC
README
A modern PHP library for verifying Yubico One-Time Passwords.
Installation
This library can be found on Packagist. The recommended way to install this is through composer.
composer require bulldog/yubico
Usage
We include Guzzle by default, but you are
welcome to use any other PHP HTTP client. You will need to create a new adapter
for any other PHP HTTP client and have it implement the OtpAdapterInterface
.
<?php include 'vendor/autoload.php'; use Bulldog\Yubico\Yubico; use Bulldog\Yubico\Adapters\GuzzleAdapter; $yubico = new Yubico('1234', 'c2VjcmV0X2tleQ==', new GuzzleAdapter()); if($yubico->verify('longonetimepasswordgeneratedfromayubicokey')) { echo "That OTP is good!\n"; } else { echo "OTP is bad!\n"; echo $yubico->getReason() . "\n"; }