Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 415 Bytes

Factory.md

File metadata and controls

13 lines (9 loc) · 415 Bytes

The Factory

In some cases, you want to load a provisioning URI and get the corresponding OTP object. That is why we created a factory.

<?php
use OTPHP\Factory;

$otp = Factory::loadFromProvisioningUri('otpauth://totp/alice%40google.com?secret=JBSWY3DPEHPK3PXP&foo=bar');

// The variable $otp is now a valid TOTPInterface or HOTPInterface object with all parameters set (including custom parameters)