Loading…
Topic
PHP
19 posts about PHP. Every summary links to the original.
- 19 posts
- 4 companies
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
Newest first
Posts
How Cloudflare WAF helps protect against phpAfterShell and other critical PHP flaws
On November 19, 2026, depthfirst disclosed phpAfterShell (CVE-2026-126714), a critical vulnerability in PHP’s default file-based session handler that can lead to remote code execution. PHP fixed it the same day in versions 8.2.36, 8.3.37, 8.4.28, 8.5.13, and 8.6.0, which also address 16 other security flaws, six of them critical. Cloudflare’s WAF blocks known phpAfterShell attack patterns for all customers, including Free plan users, using a rule first deployed in October 2026 for the php2shell vulnerabilities. For paid plans, Cloudflare added three new WAF rules for a PHP-FPM request smuggling flaw and two SOAP extension flaws, enabled by default with a Log action. The WAF is an additional defense layer, but the only complete fix is to upgrade PHP and restart every worker.
Keeping it Bref: Sentry now supports PHP on AWS Lambda
PHP applications on AWS Lambda lose visibility when requests time out or responses exceed the 6 MB limit, because the Sentry SDK is cut off before it can report. Bref, the open-source project that runs PHP on AWS Lambda, now has an official Sentry integration called sentry/sentry-bref. The integration catches timeouts by hooking into the Bref runtime after PHP-FPM is stopped, and it reports responses too large from the same point. It also creates a transaction per invocation for non-HTTP events like SQS messages and adds cold start spans (lambda.cold-start and bref.startup) to traces. AWS SDK calls can be traced opt-in per client, and every event links to the corresponding CloudWatch log for that invocation.
PhpStorm Light: Experimenting With a Lighter Version of PhpStorm
JetBrains introduced PhpStorm Light as an experimental Early Access build in June to test optimizations for startup time, memory consumption, and editing smoothness. The build defers background work such as update checks and scanning until needed, uses a lighter default inspection profile, and makes rarely used features and plugins opt-in. A separate build was used to avoid disrupting stable PhpStorm users while gathering feedback from opted-in PHP developers. The experiment showed that much of the overhead comes from work not yet requested, and that faster defaults do not require removing features. JetBrains plans to merge several PhpStorm Light improvements into the standard PhpStorm build, with each change offering a simple way to restore previous behavior.
PHP2Shell. What is it and What Do You Need to Do?
PHP2Shell combines two critical RCE vulnerabilities, CVE-2026-109618 and CVE-2026-109619, affecting every PHP version back to 5.4. The first exploit corrupts memory when a request hits PHP’s memory limit at the wrong moment, while the second leverages stale global state after a fatal error. Both are rated 9.2 on the CVSS 4.0 scale and require no authentication. Exploitation has been confirmed in the wild, including a campaign that chained PHP2Shell with a Linux privilege-escalation flaw to root 25 servers. The post provides a remediation guide covering inventory, patching to PHP 8.5.12 or later, configuration workarounds, and long-term security practices.
What’s New in PhpStorm 2026.3
PhpStorm 2026.3 introduces Air, a new workspace for agentic development that works with multiple coding agents such as Claude Agent and GitHub Copilot, using existing subscriptions without requiring a JetBrains AI subscription. It adds support for PHP 8.6 with inspections for deprecated constructors returning values and calls to mb_ereg* functions, plus quick-fixes to migrate code. Laravel development gains new inspections for unknown config keys, missing resource route methods, and unknown Livewire component methods, along with a Processes tab to manage dev server and queue workers. The terminal now runs on libghostty, improving support for keyboard shortcuts, emoji, and AI coding agents like Claude Code and Junie. Remote development features an integrated SSH connection flow and native OpenSSH support with certificate-based authentication, while cross-database queries are enabled through a DuckDB-based Workspace data source that runs in memory.
Introducing the Cloudflare PHP Capture the Flag challenge
Cloudflare launched a PHP Capture the Flag challenge via its HackerOne Bug Bounty program to test WAF protections against php2shell vulnerabilities (CVE-2026-109618 and CVE-2026-109619). The sandbox runs PHP 8.5.11 with Apache 2 via mod_php and an empty index.php behind WAF blocking rules, with a /flag file that resets every few minutes. Participants must send an authorized POST request to exploit the sandbox, execute code remotely, recover the flag, and verify it through the UI before a reset. Successful submissions require a HackerOne report with endpoint, payload, request sequence, WAF bypass explanation, and raw captures; eligible reports need a distinct bypass or payload for the same CVE. The challenge is not a substitute for patching but helps collect bypass data to strengthen defenses as AI accelerates vulnerability discovery.
Cloudflare deploys protections against php2shell vulnerability
Two PHP vulnerabilities, CVE-2026-109618 and CVE-2026-109619, collectively called php2shell, affect all web servers running PHP 5.4 or later and can enable denial of service, remote code execution, and data exposure. The flaws reside in how PHP handles memory when a request processing error occurs, either by using uninitialized data during cleanup or by following outdated memory references in a later request. Cloudflare collaborated with the PHP Foundation, OpenAI, and Wiz to deploy mitigations and released WAF protections about nine hours before public disclosure. The protections use a new full transaction detection capability that analyzes both request and response signals within the same HTTP transaction to reduce false positives. Cloudflare customers on free or paid WAF plans are protected by default, and administrators must still patch their PHP software because the vulnerabilities are in the runtime itself.
Avoid Sending SMS to Landlines in PHP with Twilio's Lookup v2 API
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
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
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
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
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
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
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
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
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
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
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
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.
Related topics
All topics →Weekly digest
The best engineering reads, once a week.