Giter Club home page Giter Club logo

otphp's Introduction

TOTP / HOTP library in PHP

Scrutinizer Quality Score Coverage Status

Build Status HHVM Status PHP 7 ready

SensioLabsInsight

Latest Stable Version Total Downloads Latest Unstable Version License

A php library for generating one time passwords according to RFC 4226 (HOTP Algorithm) and the RFC 6238 (TOTP Algorithm)

This library is compatible with Google Authenticator apps available for Android and iPhone. It is also compatible with other applications such as FreeOTP for example.

The Release Process

The release process is described here.

Prerequisites

This library needs at least PHP 5.5.9. It has been successfully tested using PHP 5.5.9, PHP 5.6, PHP 7 and HHVM

Installation

The preferred way to install this library is to rely on Composer:

composer require spomky-labs/otphp

By default, documentation and test environnement are excluded. If you want to test the library or get the documentation, please add --prefer-source option:

composer require spomky-labs/otphp --prefer-source

TOTP or HOTP?

This library provides both TOTP and HOTP.

TOTP is a time based one-time password. It lives only during few seconds (the interval). You just have to be sure that the clock of your server and your device are synchronized. This is the most common OTP.

HOTP is a counter based one-time password. Every time a password is used, the counter is updated. You have to verify that the server and the device are synchronized.

How to use

To create a new TOTP or HOTP, just instantiate the class you selected:

use OTPHP\TOTP;

$totp = new TOTP();

or

use OTPHP\HOTP;

$hotp = new HOTP();

Have a look at How to use to initialize and generate your first OTP.

Contributing

Requests for new features, bug fixed and all other ideas to make this library useful are welcome. Please follow these best practices.

Licence

This software is release under MIT licence.

otphp's People

Contributors

kix avatar leandro-lugaresi avatar scrutinizer-auto-fixer avatar spomky avatar ssx avatar vinkla avatar

Watchers

 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.