---
title: "How to Build Passwordless Auth With Twilio Verify in PHP"
description: "Passwordless authentication with PHP and Twilio Verify replaces password entry with a phone-based one-time passcode flow, intended to reduce password-related risk and simplify sign-in. The tutorial uses a Slim base project, Composer dependencies, Dotenv configuration, a Twilio Verify Service SID, and PHP session state to support the flow. Users submit a phone number through the root route; the server asks Twilio Verify to send an SMS OTP, redirects to /verify, and checks the submitted code through the verification endpoint. The example’s verification form restricts input to a six-digit numeric value, and the application reports whether verification succeeded or failed after testing locally with composer serve on port 8080."
---

# How to Build Passwordless Auth With Twilio Verify in PHP

[Twilio](https://yomu.fyi/company/twilio) · Matthew Setter · Aug 19, 2026

**Type:** Tutorial

## Summary

Passwordless authentication with PHP and Twilio Verify replaces password entry with a phone-based one-time passcode flow, intended to reduce password-related risk and simplify sign-in. The tutorial uses a Slim base project, Composer dependencies, Dotenv configuration, a Twilio Verify Service SID, and PHP session state to support the flow. Users submit a phone number through the root route; the server asks Twilio Verify to send an SMS OTP, redirects to /verify, and checks the submitted code through the verification endpoint. The example’s verification form restricts input to a six-digit numeric value, and the application reports whether verification succeeded or failed after testing locally with composer serve on port 8080.

## Context

Typing or generating passwords for new accounts and websites is described as a hassle. The tutorial presents passwordless authentication as an alternative that removes the need to remember passwords while using a one-time code sent to a user's phone.

## Approach / What changed

Build a small PHP API with Slim and Twilio Verify. Configure Twilio credentials and the Verify Service SID through environment variables, install the Twilio PHP SDK and supporting dependencies, send an SMS OTP from the root route, and verify the submitted six-digit code at the /verify route.

## Takeaways

- The application uses GET and POST handlers for both / and /verify to display forms, send an OTP, and validate the submitted code.
- The .env configuration contains TWILIO\_ACCOUNT\_SID, TWILIO\_AUTH\_TOKEN, and TWILIO\_VERIFY\_SERVICE\_SID, which are loaded and required at startup.
- The verification form uses pattern, maxlength, and numeric input settings to guide entry of a six-digit SMS code.

**Tags:** [Authentication](https://yomu.fyi/topic/authentication), [PHP](https://yomu.fyi/topic/php), [Twilio](https://yomu.fyi/topic/twilio)

- Source: [Twilio](https://www.twilio.com/en-us/blog/developers/tutorials/product/build-passwordless-auth-with-twilio-verify-php)
- Source URL: https://www.twilio.com/en-us/blog/developers/tutorials/product/build-passwordless-auth-with-twilio-verify-php
- Ingested by Yomu: 2026-09-09T13:35:06.341Z

[Read original post](https://www.twilio.com/en-us/blog/developers/tutorials/product/build-passwordless-auth-with-twilio-verify-php)
