Download the PHP package vipertecpro/otp-autofill without Composer

On this page you can find all versions of the php package vipertecpro/otp-autofill. 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-autofill

OTP Autofill for NativePHP — SMS one-time codes that fill themselves

Latest version Tests PHP NativePHP Mobile Platforms Licence Downloads

Phone verification and sign-in codes without copy-and-paste. OTP Autofill gives you a native <native:otp-field> — a row of digit boxes backed by a real system text field — and the platform machinery that fills it:

No SMS permission on either platform, nothing for app review to question. Hand-written Swift and Kotlin; the only dependency is Google Play services' play-services-auth-api-phone, which is where Android's SMS APIs live.

Features

Requirements

Installation

Requiring with Composer is not enough — an unregistered plugin does nothing. Always run native:plugin:register and confirm with native:plugin:list. A new UI component always needs a rebuild.

Permissions and project setup

Platform What the plugin adds Why
iOS nothing Keyboard code suggestions need no entitlement or Info.plist key
Android com.google.android.gms:play-services-auth-api-phone (Gradle) The SMS User Consent and SMS Retriever APIs ship in Google Play services
Android a runtime broadcast receiver, registered only while waiting Receives SMS_RETRIEVED_ACTION, protected by the Play services send permission

No AndroidManifest.xml permissions are added. The plugin never asks for READ_SMS or RECEIVE_SMS, which Google Play restricts.

Usage

@complete receives the code as soon as every box is filled — by typing, by the iOS keyboard suggestion, by pasting, or by OtpReceived setting $code. Bind with native:model so the field and your property stay in sync.

The field

Attribute Values Default
length 4–10 digits 6
native:model / value the digits so far ""
@complete method, receives the full code —
@change method, receives the digits on every edit —
autofocus focus and show the number pad when it appears off
is-error red boxes, e.g. after a wrong code off
disabled read-only, dimmed off
a11y-label, a11y-hint screen-reader text "Verification code"

Use normal layout classes around it (w-full, padding on the parent). Colours come from your NativeUI theme: primary for the active box, outline, surface, on-surface and destructive.

Android: consent or retriever

SMS User Consent SMS Retriever
User action taps Allow on a system sheet showing the SMS none
SMS format anything with a 4–10 character code must contain your app hash
Server change none add the hash to the message

start() returns consent or retriever when Android is listening, keyboard on iOS, and unavailable without Google Play services or outside a native app. Android waits up to five minutes for one message; call start() again for a resend.

The app hash (retriever mode)

Your server appends it to the SMS, e.g. Your code is 482913.\n\nFA+9qCX9VSu. The hash is derived from the package name and the signing key, so your debug build, your upload key and Play App Signing each have a different one. Read it from the build you ship (log it once from a release build) and send the right one from your server.

Web-view screens

For a Livewire or Inertia web view, use a plain input with the standard hints — iOS and Chrome then offer the code themselves:

On Android you can still call OtpAutofill::start() and put the received code into the input. To let browsers match the code to your site, end the SMS with a WebOTP line: an @ followed by your domain, a space, and # plus the code.

API

Invalid options throw InvalidArgumentException: a mode other than consent / retriever, a length outside 4–10, or a malformed sender.

Events

Event Payload Fired when
Vipertecpro\OtpAutofill\Events\OtpReceived string $code, ?string $message, string $source Android read the SMS and found a code. $source is consent or retriever.
Vipertecpro\OtpAutofill\Events\OtpFailed string $reason, ?string $message timeout (no SMS in five minutes), denied (the user tapped Deny), no_code, unavailable, error.

iOS fires no events: the code goes into the field through the keyboard and reaches you through native:model and @complete.

What you can build

OTP Autofill is a building block: the code field, the iOS keyboard suggestion and the Android SMS reading are done, and the product around them is yours. These ideas sit comfortably inside store policy because the plugin only reads the one-time code that your own service just sent to the person who is using the app, with no SMS permission. It cannot read other messages and it must never be used to look at anyone else's texts. Your server has to send the SMS through your own SMS provider; the plugin does not send anything.

Sign-in and sign-up

Money and deliveries

Services and workplaces

For zero-tap reading on Android, use retriever mode and add your app hash to the SMS; the hash is different for debug builds, your upload key and Play App Signing. On iOS the person taps the keyboard suggestion, and Android with Google Play services is required for SMS reading. Do not use the codes for anything but verifying the person who asked for them, and keep resend limits on your backend.

Limitations

Verified on

Demo

The companion demo app free-plugins-demo contains a complete "Verify your phone" screen — send, listen, autofill, verify, wrong-code and failure states — in one small NativeComponent you can copy from.

Contributing

Issues and pull requests are welcome. See the CONTRIBUTING.md file included with the package for local setup, the project layout and how it works.

Changelog

See the CHANGELOG.md file included with the package for the full version history.

Licence

MIT — see the LICENSE file included with the package.

vipertecpro is an independent developer. NativePHP, Laravel, Apple, Google, Firebase and other names are trademarks of their respective owners; this package is not affiliated with or endorsed by them. iOS and Apple are trademarks of Apple Inc. Android, Google Play and Firebase are trademarks of Google LLC.

OTP Autofill is a free plugin from vipertecpro.com, home of the paid plugins for NativePHP Mobile: Rich-Text Editor, Onboarding & Tours, Health Data, Native Charts, Paywalls & Purchases and Pausewall.


All versions of otp-autofill with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
nativephp/mobile Version ^4.0
nativephp/mobile-ui Version ^0.8
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 vipertecpro/otp-autofill contains the following files

Loading the files please wait ...