PHPackages                             clef/clef-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. [API Development](/categories/api)
4. /
5. clef/clef-php

ActiveLibrary[API Development](/categories/api)

clef/clef-php
=============

Clef PHP Library

v1.0.1(10y ago)71.2k3MITPHPPHP &gt;=5.3.3

Since Jul 15Pushed 10y ago4 watchersCompare

[ Source](https://github.com/clef/clef-php)[ Packagist](https://packagist.org/packages/clef/clef-php)[ Docs](https://getclef.com.com/)[ RSS](/packages/clef-clef-php/feed)WikiDiscussions master Synced 1w ago

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

Clef PHP bindings
=================

[](#clef-php-bindings)

[![Latest Stable Version](https://camo.githubusercontent.com/446fe242b23cb02a2aa3bfca64a552b23593d8097d4338def5fe3b605d441874/68747470733a2f2f706f7365722e707567782e6f72672f636c65662f636c65662d7068702f762f737461626c652e737667)](https://packagist.org/packages/clef/clef-php)[![License](https://camo.githubusercontent.com/9d773b08e0d41adee57b63f8983b1fe4bdd1f77ae078cf8d63809d64068a9e5c/68747470733a2f2f706f7365722e707567782e6f72672f636c65662f636c65662d7068702f6c6963656e73652e737667)](https://packagist.org/packages/clef/clef-php)

A PHP wrapper for the [Clef](https://getclef.com/) API. Authenticate a user and access their information in two lines of code.

You can sign up for a Clef account at .

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

[](#requirements)

PHP 5.3.3 and later.

Composer
--------

[](#composer)

You can install the bindings via [Composer](http://getcomposer.org/). Add this to your `composer.json`:

```
{
  "require": {
    "clef/clef-php": "1.*"
  }
}

```

Then install via:

```
composer install

```

To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/00-intro.md#autoloading):

```
require_once('vendor/autoload.php');

```

Manual Installation
-------------------

[](#manual-installation)

If you do not wish to use Composer, you can download the [latest release](https://github.com/clef/clef-php/releases). Then, to use the bindings, include the `init.php` file.

```
require_once('/path/to/clef-php/init.php');

```

Usage
-----

[](#usage)

#### Logging in a user

[](#logging-in-a-user)

When a user logs in with Clef, the browser will redirect to your `data-redirect-url`. To retrieve user information, call `get_login_information` in that endpoint:

```
\Clef\Clef::initialize(APP_ID, APP_SECRET);
$response = \Clef\Clef::get_login_information($_GET["code"]);

```

For what to do after getting user information, check out our documentation on [Associating users](http://docs.getclef.com/v1.0/docs/persisting-users).

#### Logging out a user

[](#logging-out-a-user)

When you configure your Clef integration, you can also set up a logout hook URL. Clef sends a POST to this URL whenever a user logs out with Clef, so you can log them out on your website too.

```
\Clef\Clef::initialize(APP_ID, APP_SECRET);
$clef_id = \Clef\Clef::get_logout_information($_POST["logout_token"]);

```

For what to do after getting a user who's logging out's `clef_id`, see our documentation on [Database logout](http://docs.getclef.com/v1.0/docs/database-logout).

Sample App
----------

[](#sample-app)

If you'd like to see an example of this library in action, check out the Clef PHP sample application [here](https://github.com/clef/sample-php).

Resources
---------

[](#resources)

Check out the [API docs](http://docs.getclef.com/v1.0/docs/).
Access your [developer dashboard](https://getclef.com/user/login).

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

2

Last Release

3983d ago

### Community

Maintainers

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

---

Tags

apitwo-factorclef

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[m165437/laravel-blueprint-docs

API Blueprint Renderer for Laravel

22779.5k](/packages/m165437-laravel-blueprint-docs)

PHPackages © 2026

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