---
title: "PHP"
description: "12 posts about PHP, summarised, each linking to the original."
---

# PHP
> 12 posts about PHP, summarised, each linking to the original.

## Articles

### [Avoid Sending SMS to Landlines in PHP with Twilio's Lookup v2 API](https://yomu.fyi/post/avoid-sending-sms-to-landlines-in-php-with-twilio-s-lookup-v2-api.md)
- Company: [Twilio](https://yomu.fyi/company/twilio.md)
- Author: Matthew Setter
- Published: Oct 7, 2026
- Type: Tutorial

SMS has a 98% open rate and works without internet, but sending to landlines wastes money on failed deliveries. This tutorial demonstrates filtering landlines in PHP using Twilio’s Lookup v2 API, which provides line type intelligence via the “line\_type\_intelligence” field. The core class extends PHP’s FilterIterator and overrides the accept() method to fetch each number’s line type, returning true only for “mobile” types and catching TwilioException on failure. The application uses Composer dependencies including monolog, twilio/sdk, and phpdotenv, loads credentials from a .env file, iterates over an ArrayIterator of phone numbers, logs each with Monolog to stdout, and sends an SMS only to mobile numbers. This approach avoids unnecessary charges and is straightforward using Twilio’s PHP helper library and SPL iterators.


### [How to Track Opt-Outs in PHP](https://yomu.fyi/post/how-to-track-opt-outs-in-php.md)
- Company: [Twilio](https://yomu.fyi/company/twilio.md)
- Author: Matthew Setter
- Published: Oct 2, 2026
- Type: Tutorial

This tutorial demonstrates building a PHP application that records customer opt-out preferences from SMS replies using Twilio’s Incoming Message Webhook and Event Streams, which require PHP 8.5, Composer, and SQLite. When the SMS body is an opt-out keyword such as STOP, START, or HELP, Twilio includes an OptOutType parameter in the webhook request, which the application checks using strcasecmp and array\_first. The application, based on the Twilio Slim Base project, stores the opt-out status and account SID in an SQLite database via PHP-DB and laminas-servicemanager, using a TableGateway for the user\_optouts table. The handleWebhook() function validates the OptOutType against class constants (OPT\_OUT\_TYPE\_START, OPT\_OUT\_TYPE\_STOP, OPT\_OUT\_TYPE\_HELP) and inserts a record before returning a TwiML response. Twilio already blocks further messages for standard opt-outs, but local recording enables advanced actions like syncing a CRM; the tutorial covers bootstrapping, configuring Twilio messaging services with Advanced Opt-Out, using ngrok, and verifying with an SQL query.


### [How to Augment Voice Calls with Twilio Intelligence](https://yomu.fyi/post/how-to-augment-voice-calls-with-twilio-intelligence.md)
- Company: [Twilio](https://yomu.fyi/company/twilio.md)
- Author: Matthew Setter
- Published: Sep 29, 2026
- Type: Tutorial

This tutorial shows PHP developers how to augment a Twilio voice AI agent with Conversation Intelligence, Conversation Orchestrator, and Conversation Memory. The goal is to retrieve a short summary of each customer call, analyze the caller’s sentiment, and check whether the agent followed set guidelines. The information is persisted to a SQLite database for later use. The tutorial builds on a previous voice agent tutorial and requires a Twilio account, a voice-capable phone number, and ngrok to expose the local server. It walks through setting up Conversation Orchestrator, Conversation Intelligence, and the application database, then testing the flow with example questions. The post also mentions the Conversations API (V2) for retrieving call summaries and sentiment analysis.


### [How to Build an RCS Business Messaging Campaign with Twilio in PHP](https://yomu.fyi/post/how-to-build-an-rcs-business-messaging-campaign-with-twilio-in-php.md)
- Company: [Twilio](https://yomu.fyi/company/twilio.md)
- Author: Dhruv Patel, Matthew Setter
- Published: Sep 28, 2026
- Type: Tutorial

Twilio’s tutorial explains how to build an RCS Business Messaging campaign in PHP, reusing the same Programmable Messaging API used for SMS. RCS turns standard text messages into branded conversations with images, carousels, verified sender logos, suggested replies, and read receipts delivered through the recipient’s default messaging app. The walkthrough covers registering an RCS Sender, attaching it to a Messaging Service, and designing a rich card template in the Twilio Content Template Builder. It then shows how to broadcast the campaign to a recipient list, track delivery status via a status callback webhook, and capture replies through an inbound webhook. Troubleshooting guidance addresses common issues such as messages falling back to SMS, senders pending approval, and missing status callbacks.


### [Continuing to Move PHP Open Source Forward](https://yomu.fyi/post/continuing-to-move-php-open-source-forward.md)
- Company: [Jetbrains](https://yomu.fyi/company/jetbrains.md)
- Author: Brent Roose
- Published: Sep 24, 2026
- Type: Announcement

Each year, PhpStorm selects five open-source projects to sponsor for a full year, providing financial support and raising awareness of open source in the PHP community. For this year, the chosen projects are PHPUnit, Lerd, static-php-cli, Composer, and Larabelles, selected from community suggestions based on their impact and need for financing. Sebastian Bergmann, creator and maintainer of PHPUnit, offers the most widely used testing suite for PHP. George Dumitrescu’s Lerd manages local PHP installations and servers, while Jerry Ma’s static-php-cli is used by FrankenPHP and Native PHP. PhpStorm continues its sponsorship of the PHP Foundation and encourages other organizations to contribute to open source, as every bit of support makes a substantial difference when added together.


### [Building Sentry's Laravel AI Integration](https://yomu.fyi/post/building-sentry-s-laravel-ai-integration.md)
- Company: [Sentry](https://yomu.fyi/company/sentry.md)
- Author: Martin Linzmayer
- Published: Sep 21, 2026
- Type: Announcement

Sentry’s Laravel AI integration, built during an internal Agent Hackweek, provides Agent Tracing for Laravel AI agents. The author used Claude for coding, which initially produced poor generic helper code. Laravel AI emits lifecycle events for agents and tool calls, but not for individual LLM invocations. To capture these, the integration matches outgoing HTTP requests to active invocations using provider URL prefixes, associating with the most recently started invocation if multiple match. Enabling the integration requires only updating to sentry-laravel 4.27, with no Sentry-specific code. Traces appear in Sentry’s Explore > Agents section, showing conversations, tool calls, and their inputs and outputs.


### [How to Connect Your Twilio Agent to External APIs with PHP](https://yomu.fyi/post/how-to-connect-your-twilio-agent-to-external-apis-with-php.md)
- Company: [Twilio](https://yomu.fyi/company/twilio.md)
- Author: Amanda Lange, Matthew Setter
- Published: Sep 11, 2026
- Type: Tutorial

The tutorial shows how to connect a Twilio voice agent to external REST APIs so an LLM-driven conversation can retrieve live information or support actions such as checking inventory or booking appointments. It builds the example in PHP 8.5 or later with OpenSwoole, Twilio Conversation Relay, OpenAI, and a WebSocket server, using Cat Facts as an unauthenticated API. The application exposes a POST /voice webhook that returns TwiML and connects Conversation Relay to a wss /ws endpoint, while session handling passes caller prompts into the OpenAI service. Tool calling routes the request to the Cat Facts endpoint, parses the JSON fact field, and returns either the fact, “No fact returned.”, or an error when the API response is unsuccessful or unavailable. Testing requires running php server.php, exposing port 8080 with ngrok, and configuring the Twilio number’s incoming webhook to /voice; the conclusion says external HTTP endpoints give agents real-time data.


### [How to Orchestrate Multi-Call Conversations with an LLM and Twilio Conversation Memory with PHP](https://yomu.fyi/post/how-to-orchestrate-multi-call-conversations-with-an-llm-and-twilio-con.md)
- Company: [Twilio](https://yomu.fyi/company/twilio.md)
- Author: Amanda Lange, Matthew Setter
- Published: Sep 11, 2026
- Type: Tutorial

This tutorial shows how to build a PHP voice agent that retains caller context, preferences, and action history across separate inbound calls. It uses Twilio Conversation Memory with a Memory Store, an Open Swoole service, Twilio ConversationRelay, and an OpenAI integration using gpt-4o-mini; the example models an auto-repair shop assistant. The OpenAI service appends supplied prior customer context to its system prompt, while streamed responses are sent through a WebSocket and environment variables provide API credentials and the Memory Store ID. After running the service on port 9501, exposing it with ngrok, and configuring the phone-number webhook, the tutorial tests two calls from the same number and says the second call should remember details from the first.


### [How to Approve Real Users and Block Fake Accounts at Sign Up with Lookup and Verify in PHP](https://yomu.fyi/post/how-to-approve-real-users-and-block-fake-accounts-at-sign-up-with-look-php.md)
- Company: [Twilio](https://yomu.fyi/company/twilio.md)
- Author: Kelley Robinson, Matthew Setter
- Published: Aug 31, 2026
- Type: Tutorial

The tutorial shows how to combine Twilio Lookup and Verify in a PHP sign-up flow that screens phone numbers before sending an OTP. It starts with Line Type Intelligence to accept mobile numbers, optionally checks reachability with Line Status, and uses Identity Match to compare submitted first and last names against authoritative sources without revealing underlying data. If those checks pass, the application sends a six-digit verification code and validates it through a Verify service. The provided implementation uses PHP 8.5, Slim, Twig, Monolog, and the Twilio REST client, with environment flags controlling optional checks and logs recorded in data/app.log. Testing covers mobile, toll-free, VoIP, and name-mismatch cases, while the pricing discussion recommends ordering cheaper checks before more expensive Identity Match and Verify calls.


### [How to Confirm Phone Number Ownership with Lookup Identity Match in PHP](https://yomu.fyi/post/how-to-confirm-phone-number-ownership-with-lookup-identity-match-in-ph.md)
- Company: [Twilio](https://yomu.fyi/company/twilio.md)
- Author: Kelley Robinson, Matthew Setter
- Published: Aug 31, 2026
- Type: Tutorial

The post presents a PHP signup flow that uses Twilio Lookup Identity Match to confirm whether submitted identity details correspond to a phone number and to reduce signup fraud. Identity Match performs a zero-knowledge match against authoritative sources such as mobile carrier records, using supplied fields including names, addresses, national IDs, or dates of birth. The implementation builds on a Slim PHP project, adds Twig form handling and the Twilio REST client, then sends the phone number, first name, and last name through the Lookup API. Registration succeeds only when the number is valid and both names return exact\_match or high\_partial\_match; otherwise, the form displays an instruction to provide information for a phone number the user owns.


### [How to Build Passwordless Auth With Twilio Verify in PHP](https://yomu.fyi/post/how-to-build-passwordless-auth-with-twilio-verify-in-php.md)
- Company: [Twilio](https://yomu.fyi/company/twilio.md)
- Author: Matthew Setter
- Published: Aug 19, 2026
- Type: Tutorial

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 Using TOTP With Twilio Verify in PHP](https://yomu.fyi/post/how-to-build-passwordless-auth-using-totp-with-twilio-verify-in-php.md)
- Company: [Twilio](https://yomu.fyi/company/twilio.md)
- Author: Matthew Setter
- Published: Aug 18, 2026
- Type: Tutorial

Passwordless authentication can replace passwords with time-based one-time passwords (TOTP), but implementing the setup and verification flow requires coordinating an authenticator app with a verification service. This tutorial builds a web-based PHP application using Twilio Verify, Slim, Twig, and the Twilio PHP Helper Library. Users submit a username, create an initially unverified Factor resource, scan a QR code or enter its setup code, and submit the first six-digit code; later, they enter codes generated by the authenticator app for validation. The project configures Twilio credentials and a Verify Service SID through environment variables, adds session and flash-message support, generates QR codes, defines routes and templates, and runs locally with composer serve on port 8080. The conclusion presents TOTP passwordless authentication as more convenient and potentially more secure than passwords, while acknowledging added application complexity.
