PHPackages                             duosecurity/duo\_universal\_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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. duosecurity/duo\_universal\_php

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

duosecurity/duo\_universal\_php
===============================

A PHP implementation of the Duo Universal SDK.

1.1.2(3mo ago)251.3M—3.5%13[2 issues](https://github.com/duosecurity/duo_universal_php/issues)9BSD-3-ClausePHPPHP &gt;=7.4CI passing

Since Mar 15Pushed 3mo ago28 watchersCompare

[ Source](https://github.com/duosecurity/duo_universal_php)[ Packagist](https://packagist.org/packages/duosecurity/duo_universal_php)[ Docs](https://duo.com/)[ RSS](/packages/duosecurity-duo-universal-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (8)Used By (9)

Duo Universal PHP library
=========================

[](#duo-universal-php-library)

[![Build Status](https://github.com/duosecurity/duo_universal_php/workflows/PHP%20CI/badge.svg)](https://github.com/duosecurity/duo_universal_php/actions)

This SDK allows a web developer to quickly add Duo's interactive, self-service, two-factor authentication to any PHP web login form.

What's included:

- `src` - The PHP Duo SDK for interacting with the Duo Universal Prompt
- `example` - An example PHP application with Duo integrated
- `tests` - Test cases

Getting started
---------------

[](#getting-started)

This library requires PHP 8.2 or later

To use SDK in your existing developing environment, install it from Packagist

```
composer require duosecurity/duo_universal_php

```

Once it's installed, see our developer documentation at  and `sample/index.php` in this repo for guidance on integrating Duo 2FA into your web application.

### TLS 1.2 and 1.3 Support

[](#tls-12-and-13-support)

Duo\_universal\_php uses PHP's cURL extension and OpenSSL for TLS operations. TLS support will depend on the versions of multiple libraries:

TLS 1.2 support requires PHP 5.5 or higher, curl 7.34.0 or higher, and OpenSSL 1.0.1 or higher.

TLS 1.3 support requires PHP 7.3 or higher, curl 7.61.0 or higher, and OpenSSL 1.1.1 or higher.

Contribute
----------

[](#contribute)

To contribute, fork this repo and make a pull request with your changes when they are ready.

Install the SDK from source:

```
composer install

```

Run interactive mode

```
php -a -d auto_prepend_file=vendor/autoload.php

Interactive shell

php > $client = new Duo\DuoUniversal\Client("IntegrationKey", "SecretKey", "api-XXXXXXXX.duosecurity.com", "https://example.com");
php > $state = $client->generateState();
php > $username = "example";
string(700) "https://api-XXXXXXXX.duosecurity.com/oauth/v1/authorize?response_type=code&client_id=DIXXXXXXXXXXXXXXXXXX&scope=openid&redirect_uri=https%3A%2F%2Fexample.com&request=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzY29wZSI6Im9wZW5pZCIsInJlZGlyZWN0X3VyaSI6Imh0dHBzOlwvXC9leGFtcGxlLmNvbSIsImNsaWVudF9pZCI6IkRJWFhYWFhYWFhYWFhYWFhYWFhYIiwiaXNzIjoiRElYWFhYWFhYWFhYWFhYWFhYWFgiLCJhdWQiOiJodHRwczpcL1wvYXBpLVhYWFhYWFhYLmR1b3NlY3VyaXR5LmNvbSIsImV4cCI6MTYxMjI5OTA3Nywic3RhdGUiOiJtYjlWalFGeDNzMEswRVpidVBJMmlCVWE4N29qbWFMTUl2VksiLCJyZXNwb25zZV90eXBlIjoiY29kZSIsImR1b191bmFtZSI6ImV4YW1wbGUiLCJ1c2VfZHVvX2NvZGVfYXR0cmlidXRlIjp0cnVlfQ.8Pr02LJd0pi6rsiAf5mvzGbf51piHysHyP5PlmnMiwNIkQ0HsYED0wECilXxsIyISz--oU528Cy7Sfebj0copg"

```

Tests
-----

[](#tests)

```
./vendor/bin/phpunit --process-isolation tests

```

Lint
----

[](#lint)

To run linter

```
./vendor/bin/phpcs --standard=.duo_linting.xml -n src/* tests

```

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance78

Regular maintenance activity

Popularity52

Moderate usage in the ecosystem

Community33

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~357 days

Recently: every ~327 days

Total

6

Last Release

103d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.3

1.1.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/255c187591bf809c09b067f6e574faa010153e59cba417a122aec9afcb4ed582?d=identicon)[duo\_security](/maintainers/duo_security)

---

Top Contributors

[![AaronAtDuo](https://avatars.githubusercontent.com/u/26978047?v=4)](https://github.com/AaronAtDuo "AaronAtDuo (19 commits)")[![jeffreyparker](https://avatars.githubusercontent.com/u/593286?v=4)](https://github.com/jeffreyparker "jeffreyparker (15 commits)")[![yizshi](https://avatars.githubusercontent.com/u/61877973?v=4)](https://github.com/yizshi "yizshi (3 commits)")[![ishanvyas22](https://avatars.githubusercontent.com/u/17404636?v=4)](https://github.com/ishanvyas22 "ishanvyas22 (2 commits)")[![ysyrota](https://avatars.githubusercontent.com/u/1176433?v=4)](https://github.com/ysyrota "ysyrota (2 commits)")[![xdesai](https://avatars.githubusercontent.com/u/19935687?v=4)](https://github.com/xdesai "xdesai (1 commits)")[![mbish](https://avatars.githubusercontent.com/u/1400336?v=4)](https://github.com/mbish "mbish (1 commits)")[![andrrod3](https://avatars.githubusercontent.com/u/128161510?v=4)](https://github.com/andrrod3 "andrrod3 (1 commits)")[![DuoKristina](https://avatars.githubusercontent.com/u/10851093?v=4)](https://github.com/DuoKristina "DuoKristina (1 commits)")

---

Tags

duomfaphp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/duosecurity-duo-universal-php/health.svg)

```
[![Health](https://phpackages.com/badges/duosecurity-duo-universal-php/health.svg)](https://phpackages.com/packages/duosecurity-duo-universal-php)
```

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k272.7M162](/packages/google-auth)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2509.6M48](/packages/thenetworg-oauth2-azure)[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[robsontenorio/laravel-keycloak-guard

🔑 Simple Keycloak Guard for Laravel

5161.1M3](/packages/robsontenorio-laravel-keycloak-guard)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[wp-graphql/wp-graphql-jwt-authentication

JWT Authentication for WPGraphQL

361118.4k1](/packages/wp-graphql-wp-graphql-jwt-authentication)

PHPackages © 2026

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