Coder Social home page Coder Social logo

clef-php's Introduction

Clef PHP bindings

Latest Stable Version License

A PHP wrapper for the Clef API. Authenticate a user and access their information in two lines of code.

You can sign up for a Clef account at https://getclef.com.

Requirements

PHP 5.3.3 and later.

Composer

You can install the bindings via Composer. Add this to your composer.json:

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

Then install via:

composer install

To use the bindings, use Composer's autoload:

require_once('vendor/autoload.php');

Manual Installation

If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php file.

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

Usage

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.

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.

Sample App

If you'd like to see an example of this library in action, check out the Clef PHP sample application here.

Resources

Check out the API docs.
Access your developer dashboard.

clef-php's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.