PHPackages                             grizzlyware/yubikey-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. grizzlyware/yubikey-php

ActiveLibrary[Security](/categories/security)

grizzlyware/yubikey-php
=======================

A pure PHP interface to Yubico for verifying YubiKey one time passwords

1.0.2(5y ago)7733↑20%[1 issues](https://github.com/grizzlyware/yubikey-php/issues)MITPHPPHP &gt;=5.6CI failing

Since Dec 20Pushed 5y ago3 watchersCompare

[ Source](https://github.com/grizzlyware/yubikey-php)[ Packagist](https://packagist.org/packages/grizzlyware/yubikey-php)[ RSS](/packages/grizzlyware-yubikey-php/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

[![Grizzlyware logo](./assets/images/grizzlyware-logo.svg)](./assets/images/grizzlyware-logo.svg)

YubiKey Validation Library
==========================

[](#yubikey-validation-library)

This library allows you to validate YubiKey OTPs (one time passwords) easily. It's written in pure PHP, requiring only cURL to connect to Yubico's servers.

Requirements
------------

[](#requirements)

- PHP 5.6+
- cURL

Installation
------------

[](#installation)

`$ composer require grizzlyware/yubikey-php`

Example
-------

[](#example)

```
require 'vendor/autoload.php';

// These can be obtained from Yubico: https://upgrade.yubico.com/getapikey/
$clientId = 12345; // Replace with your client ID
$clientSecret = 'YOUR_SECRET'; // Replace with your client secret. This can also be null or omitted, but the requests and responses will not be signed

// This will come from your user
$otpToValidate = 'OTP_GENERATED_BY_HARDWARE_YUBIKEY';

// Create the validator instance
$yubiKeyValidator = new \Grizzlyware\YubiKey\Validator($clientId, $clientSecret);

try
{
    // Check the OTP
    $yubiKeyValidator->verifyOtp($otpToValidate);

    // OTP was validated successfully
}
catch(Grizzlyware\YubiKey\Exceptions\Yubico\BadOtpException $e)
{
    // YubiKey failed validation
}
catch(Grizzlyware\YubiKey\Exceptions\Exception $e)
{
    // Other error relating to Yubico validation
}
catch(\Exception $e)
{
    // PHP level exception
}
```

### Validating the key is the same between uses

[](#validating-the-key-is-the-same-between-uses)

The first 12 digits of a YubiKey OTP are always the same and unique to that key. That segment can be stored in your app to check against incoming OTPs before validating the OTP with Yubico. You can attach multiple YubiKeys to a user by storing multiple OTP prefixes.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover a security vulnerability within this project, please contact Grizzlyware Ltd directly (). All security vulnerabilities will be promptly addressed.

Credits
-------

[](#credits)

Built open source by [Grizzlyware](https://www.grizzlyware.com) for the greater benefit and security of the internet.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~252 days

Total

3

Last Release

1874d ago

PHP version history (2 changes)1.0PHP ^5.6

1.0.1PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/b8484110cb3665a1502f4095420c5a646e6694f3c42d63a6fcc8f5fd1736a755?d=identicon)[mewejo](/maintainers/mewejo)

---

Top Contributors

[![mewejo](https://avatars.githubusercontent.com/u/1097093?v=4)](https://github.com/mewejo "mewejo (17 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/grizzlyware-yubikey-php/health.svg)

```
[![Health](https://phpackages.com/badges/grizzlyware-yubikey-php/health.svg)](https://phpackages.com/packages/grizzlyware-yubikey-php)
```

###  Alternatives

[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k18.0M134](/packages/mews-purifier)[paragonie/ecc

PHP Elliptic Curve Cryptography library

24772.0k35](/packages/paragonie-ecc)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
