Intercept is a modular, drop-in collection of reusable AI agent middleware for the Laravel AI SDK offering middleware across security, observability, performance and guidance. It works by siting between your AI agent and your AI provider providing guardrails to prompts before they reach the provider, just like a typical HTTP middleware that sits between the route and your app's business logic.
Watch a quick demo of Intercept in action.
Important
Requires PHP 8.4+ and laravel/ai.
Documentation on the full suite of middleware is available on the documentation site. The roadmap provides an overview of planned features, upcoming middleware, and the project's future direction, while the changelog documents notable changes between releases.
Official documentation can be found at https://intercept.promptphp.com/ or the docs directory on GitHub.
We follow the Laravel Code of Conduct. We expect you to abide by these guidelines as well.
Intercept by PromptPHP is open-sourced software licensed under the MIT license.
This library is created by Victor Ukam with contributions from the Open Source Community. If you've found this package useful, please consider sponsoring this project. It will go a long way to help with maintenance.

