Download the PHP package otp-id/otp-id-php without Composer

On this page you can find all versions of the php package otp-id/otp-id-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package otp-id-php

otp-id-php

Official PHP SDK for the OTP.ID V3 API — multi-channel OTP delivery and verification (WhatsApp, SMS, Voice, Email, Missed Call, and WhatsApp Inbound) with prepaid billing.

CI

Install

Requires PHP >= 7.4.

Quickstart

Error handling

Every non-success API response is an OtpId\Exception\ApiException:

Invalid SDK usage — an empty API key or an empty otp_id passed to verifyOtp()/otpStatus() — throws a plain \InvalidArgumentException, not OtpIdException. Treat it as a programming error to fix in your code, not something to catch at runtime.

A wrong code on verifyOtp() is not an error: the server answers HTTP 200 with verified: false, and the SDK returns a VerifyResult with reason: "mismatch". Expired, locked, or already-used transactions do throw an ApiException (OTP_EXPIRED, TOO_MANY_ATTEMPTS, ALREADY_USED).

Channels

Constant Value Notes
Channel::WHATSAPP whatsapp requestOtp() + sendOtp()
Channel::SMS sms requestOtp() + sendOtp()
Channel::VOICE voice requestOtp() only
Channel::EMAIL email requestOtp() + sendOtp()
Channel::MISSCALL misscall use requestOtp() for misscall; user completes the caller's number
Channel::WHATSAPP_INBOUND whatsapp_inbound requestOtp() only; user messages OTP.ID

Bring your own code

WhatsApp Inbound (user-initiated)

No code to type: show the user $res->verification->waLink and let OTP.ID match their incoming message. Never call verifyOtp() for these transactions — detect completion via the otp.verified webhook or by polling otpStatus().

Missed Call

The last digits of the calling number are the code. Show $res->verification->prefix and ask the user to complete the number, then pass the completed digits to verifyOtp().

Account & top-up

Webhook: otp.verified

OTP.ID signs every webhook with HMAC-SHA256(secret, timestamp + "." + body). Webhook::parseVerifiedEvent() checks the signature (constant-time), rejects timestamps outside ±5 minutes by default (replay protection, configurable via the $tolerance parameter), and decodes the payload:

Configuration

The SDK never retries a request. If you add retries, only retry requestOtp()/sendOtp() calls that carry an external_id (the server replays them idempotently) — retrying without one may deliver a second OTP.

Examples

Runnable, per-channel examples live in examples/: whatsapp.php, sms.php, voice.php, email.php, misscall.php, whatsapp_inbound.php, send.php. Each reads OTPID_API_KEY and OTPID_DESTINATION from the environment and is run with php examples/<file>.php.

License

MIT — see LICENSE.


All versions of otp-id-php with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package otp-id/otp-id-php contains the following files

Loading the files please wait ...