settermjd/mezzio-twilio-webhook-validator
最新稳定版本:0.1.1
Composer 安装命令:
composer require settermjd/mezzio-twilio-webhook-validator
包简介
This package provides middleware for validating Twilio webhooks.
README 文档
README
Mezzio Twilio Webhook Validator
This package provides PSR-15-compliant middleware for validating Twilio webhooks in Mezzio applications.
Requirements
To use the application, you'll need the following:
- A Twilio account (free or paid). Create an account if you don't already have one.
- PHP 8.4
- Composer installed globally
Usage
The package is designed to be used as part of Mezzio-based applications, and goes to a lot of effort to make doing so as simple as possible.
Install the package
To install the package, use Composer by running the following command:
composer require settermjd/mezzio-twilio-webhook-validator
During installation, the project's ConfigProvider will be loaded into your Mezzio application's config/config.php, loading all of the required services into the application's DI container.
Set the required environment variables
The package requires two environment variables to be set: TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN.
To do that:
- Log in to the Twilio Console in your browser of choice
- Copy the Account SID and Auth Token from the Account Info panel in the Console's main dashboard
- Copy .env.example as .env
- In .env paste the two values as the values for
TWILIO_ACCOUNT_SIDandTWILIO_AUTH_TOKEN, respectively
How to Use the Middleware
To use the middleware, you can pipe it so that it's used for every route.
To do that, in config/pipeline.php, add the following before DispatchMiddleware is piped.
use Settermjd\Mezzio\Twilio\WebhookValidator\Middleware\WebhookValidatorMiddleware; // ... $app->pipe(WebhookValidatorMiddleware::class);
Alternatively, you can add it just for individual routes.
To do that, configure the route's middleware as an array, with WebhookValidatorMiddleware listed before the route's handler.
use Settermjd\Mezzio\Twilio\WebhookValidator\Middleware\WebhookValidatorMiddleware; // ... $app->get( '/contact', [ WebhookValidatorMiddleware::class, App\Handler\ContactHandler::class, ], 'contact' );
Contributing
If you want to contribute to the project, whether you have found issues with it or just want to improve it, here's how:
- Issues: ask questions and submit your feature requests, bug reports, etc
- Pull requests: send your improvements
Did You Find the Project Useful?
If the project was useful, and you want to say thank you and/or support its active development, here's how:
Add a GitHub Star to the project Write an interesting article about the project wherever you blog
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2025-09-19
