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.2.0(3w ago)252.0M↓22.4%13[2 issues](https://github.com/duosecurity/duo_universal_php/issues)9BSD-3-ClausePHPPHP &gt;=7.4CI passing

Since Mar 15Pushed 3w ago27 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 2w ago

READMEChangelog (6)Dependencies (6)Versions (9)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

62

—

FairBetter than 99% of packages

Maintenance94

Actively maintained with recent releases

Popularity53

Moderate usage in the ecosystem

Community35

Small or concentrated contributor base

Maturity59

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

Total

7

Last Release

26d 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 (20 commits)")[![jeffreyparker](https://avatars.githubusercontent.com/u/593286?v=4)](https://github.com/jeffreyparker "jeffreyparker (17 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)")[![cisco-dmytro-hissa](https://avatars.githubusercontent.com/u/260683862?v=4)](https://github.com/cisco-dmytro-hissa "cisco-dmytro-hissa (2 commits)")[![ysyrota](https://avatars.githubusercontent.com/u/1176433?v=4)](https://github.com/ysyrota "ysyrota (2 commits)")[![mbish](https://avatars.githubusercontent.com/u/1400336?v=4)](https://github.com/mbish "mbish (1 commits)")[![xdesai](https://avatars.githubusercontent.com/u/19935687?v=4)](https://github.com/xdesai "xdesai (1 commits)")[![DuoKristina](https://avatars.githubusercontent.com/u/10851093?v=4)](https://github.com/DuoKristina "DuoKristina (1 commits)")[![andrrod3](https://avatars.githubusercontent.com/u/128161510?v=4)](https://github.com/andrrod3 "andrrod3 (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.4k302.1M240](/packages/google-auth)[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

121269.8k1](/packages/ellaisys-aws-cognito)[rainlab/user-plugin

User plugin for October CMS

11855.3k17](/packages/rainlab-user-plugin)

PHPackages © 2026

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