PHP Classes

How to use PHP AI Agent to Improve the Security of Prompts Passed to Artificial Intelligence Services Using the Package Intercept: Filter prompts to artificial intelligence services

Recommend this page to a friend!
  Info   Documentation   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2026-07-04 (21 days ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
intercept 0.4MIT/X Consortium ...8.2Security, Artificial intelligence, PHP 8
Description 

Author

This package can filter prompts to artificial intelligence services.

It provides a set of middleware classes that can be used to intercept prompt requests to be sent to artificial intelligence service providers and can take action before the prompt reaches the provider.

Currently this package provides middleware classes to

- Detect common prompt injection attempts such as "ignore previous instructions."

- Detects structured sensitive values such as IP addresses.

Picture of Victor John Ukam
  Performance   Level  
Name: Victor John Ukam is available for providing paid consulting. Contact Victor John Ukam .
Classes: 3 packages by
Country: United Kingdom
Age: 32
All time rank: Not yet ranked
Week rank: Not yet ranked
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

Instructions

Documentation

<p align="center">

<img src="docs/logo/intercept-banner-dark.jpg" alt="Intercept by PromptPHP" width="100%">

</p>

<p align="center">

<a href="https://packagist.org/packages/promptphp/intercept">
    <img src="https://img.shields.io/packagist/v/promptphp/intercept?style=flat-square" alt="Latest Version on Packagist">
</a>
<a href="https://github.com/promptphp/intercept/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/promptphp/intercept"></a>

</p>

Introduction

Intercept is a modular, drop-in collection of reusable AI agent middleware for the Laravel AI SDK.

Requirements

> [!Important] > Requires PHP 8.4+ and laravel/ai.

AI Agent Middleware collection

Browse the full catalog of middleware on the documentation site.

Documentation

Full documentation can be found at https://intercept.promptphp.com/ or the docs directory on GitHub.

Contributing

Thank you for considering contributing to Intercept by PromptPHP. The contribution guide can be found in CONTRIBUTING.md.

Code of Conduct

We follow the Laravel Code of Conduct. We expect you to abide by these guidelines as well.

Security Vulnerabilities

If you discover a security vulnerability within Intercept by PromptPHP, please email Victor Ukam at victorjohnukam@gmail.com. All security vulnerabilities will be addressed promptly.

License

Intercept by PromptPHP is open-sourced software licensed under the MIT license.

Support

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.


Screenshots (2)  
  • docs/logo/intercept-banner-dark.jpg
  • docs/logo/intercept-banner-light.jpg
  Files folder image Files (82)  
File Role Description
Files folder image.github (3 files, 1 directory)
Files folder image.vscode (1 file)
Files folder imagedocs (10 files, 4 directories)
Files folder imagesrc (3 directories)
Files folder imagetests (2 files, 1 directory)
Files folder imagetools (8 files)
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpstan.neon Data Auxiliary data
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file pint.json Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file ROADMAP.md Data Auxiliary data
Accessible without login Plain text file split-overrides.json Data Auxiliary data

  Files folder image Files (82)  /  .github  
File Role Description
Files folder imageworkflows (2 files)
  Accessible without login Plain text file CODEOWNERS Data Auxiliary data
  Accessible without login Plain text file FUNDING.yml Data Auxiliary data
  Accessible without login Plain text file pull_request_template.md Data Auxiliary data

  Files folder image Files (82)  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file publish.yml Data Auxiliary data
  Accessible without login Plain text file tests.yml Data Auxiliary data

  Files folder image Files (82)  /  .vscode  
File Role Description
  Accessible without login Plain text file settings.json Data Auxiliary data

  Files folder image Files (82)  /  docs  
File Role Description
Files folder imagecontributor-resources (1 file)
Files folder imageguides (3 files)
Files folder imagelogo (2 files)
Files folder imagemiddleware (2 files)
  Accessible without login Plain text file .editorconfig Data Auxiliary data
  Accessible without login Plain text file .mintignore Data Auxiliary data
  Accessible without login Plain text file AGENTS.md Data Auxiliary data
  Accessible without login Plain text file changelog.mdx Data Auxiliary data
  Accessible without login Plain text file configuration.mdx Data Auxiliary data
  Accessible without login Plain text file docs.json Data Auxiliary data
  Accessible without login Plain text file favicon.svg Data Auxiliary data
  Accessible without login Plain text file index.mdx Data Auxiliary data
  Accessible without login Plain text file LICENSE Lic. License text
  Plain text file quickstart.mdx Class Class source

  Files folder image Files (82)  /  docs  /  contributor-resources  
File Role Description
  Accessible without login Plain text file support.mdx Data Auxiliary data

  Files folder image Files (82)  /  docs  /  guides  
File Role Description
  Accessible without login Plain text file handling-blocked-prompts.mdx Data Auxiliary data
  Accessible without login Plain text file production-rollout.mdx Data Auxiliary data
  Accessible without login Plain text file security-notes.mdx Data Auxiliary data

  Files folder image Files (82)  /  docs  /  middleware  
File Role Description
  Plain text file injection-guard.mdx Class Class source
  Plain text file pii-redactor.mdx Class Class source

  Files folder image Files (82)  /  src  
File Role Description
Files folder imageInjectionGuard (2 files, 2 directories)
Files folder imagePIIRedactor (2 files, 2 directories)
Files folder imageSupport (2 files, 3 directories)

  Files folder image Files (82)  /  src  /  InjectionGuard  
File Role Description
Files folder imagesrc (1 file, 3 directories)
Files folder imagetests (1 file, 2 directories)
  Accessible without login Plain text file composer.json Data Auxiliary data
  Plain text file README.md Class Class source

  Files folder image Files (82)  /  src  /  InjectionGuard  /  src  
File Role Description
Files folder imageDefaults (1 file)
Files folder imageEnums (1 file)
Files folder imageExceptions (1 file)
  Plain text file PromptInjectionGuard.php Class Class source

  Files folder image Files (82)  /  src  /  InjectionGuard  /  src  /  Defaults  
File Role Description
  Plain text file InjectionGuardDefaults.php Class Class source

  Files folder image Files (82)  /  src  /  InjectionGuard  /  src  /  Enums  
File Role Description
  Accessible without login Plain text file ActionTypes.php Aux. Configuration script

  Files folder image Files (82)  /  src  /  InjectionGuard  /  src  /  Exceptions  
File Role Description
  Plain text file PromptInjectionGuardException.php Class Class source

  Files folder image Files (82)  /  src  /  InjectionGuard  /  tests  
File Role Description
Files folder imageExceptions (1 file)
Files folder imageFixtures (2 files)
  Plain text file PromptInjectionGuardTest.php Class Class source

  Files folder image Files (82)  /  src  /  InjectionGuard  /  tests  /  Exceptions  
File Role Description
  Plain text file PromptInjectionGuardExceptionTest.php Class Class source

  Files folder image Files (82)  /  src  /  InjectionGuard  /  tests  /  Fixtures  
File Role Description
  Plain text file PromptInjectionGuardTestAgent.php Class Class source
  Plain text file PromptInjectionGuardTestProvider.php Class Class source

  Files folder image Files (82)  /  src  /  PIIRedactor  
File Role Description
Files folder imagesrc (1 file, 5 directories)
Files folder imagetests (1 file, 2 directories)
  Accessible without login Plain text file composer.json Data Auxiliary data
  Plain text file README.md Class Class source

  Files folder image Files (82)  /  src  /  PIIRedactor  /  src  
File Role Description
Files folder imageDefaults (1 file)
Files folder imageDetectors (1 file, 1 directory)
Files folder imageEnums (2 files)
Files folder imageExceptions (1 file)
Files folder imageValueObjects (2 files)
  Plain text file PIIRedactor.php Class Class source

  Files folder image Files (82)  /  src  /  PIIRedactor  /  src  /  Defaults  
File Role Description
  Plain text file PIIRedactorDefaults.php Class Class source

  Files folder image Files (82)  /  src  /  PIIRedactor  /  src  /  Detectors  
File Role Description
Files folder imageContracts (1 file)
  Plain text file RegexDetector.php Class Class source

  Files folder image Files (82)  /  src  /  PIIRedactor  /  src  /  Detectors  /  Contracts  
File Role Description
  Plain text file Detector.php Class Class source

  Files folder image Files (82)  /  src  /  PIIRedactor  /  src  /  Enums  
File Role Description
  Accessible without login Plain text file ActionTypes.php Aux. Configuration script
  Accessible without login Plain text file EntityTypes.php Aux. Configuration script

  Files folder image Files (82)  /  src  /  PIIRedactor  /  src  /  Exceptions  
File Role Description
  Plain text file PIIRedactorException.php Class Class source

  Files folder image Files (82)  /  src  /  PIIRedactor  /  src  /  ValueObjects  
File Role Description
  Plain text file Detection.php Class Class source
  Plain text file RedactionResult.php Class Class source

  Files folder image Files (82)  /  src  /  PIIRedactor  /  tests  
File Role Description
Files folder imageExceptions (1 file)
Files folder imageFixtures (2 files)
  Plain text file PIIRedactorTest.php Class Class source

  Files folder image Files (82)  /  src  /  PIIRedactor  /  tests  /  Exceptions  
File Role Description
  Plain text file PIIRedactorExceptionTest.php Class Class source

  Files folder image Files (82)  /  src  /  PIIRedactor  /  tests  /  Fixtures  
File Role Description
  Plain text file PIIRedactorTestAgent.php Class Class source
  Plain text file PIIRedactorTestProvider.php Class Class source

  Files folder image Files (82)  /  src  /  Support  
File Role Description
Files folder imageconfig (1 file)
Files folder imagesrc (2 files, 1 directory)
Files folder imagetests (2 files, 1 directory)
  Accessible without login Plain text file composer.json Data Auxiliary data
  Accessible without login Plain text file README.md Doc. Read me

  Files folder image Files (82)  /  src  /  Support  /  config  
File Role Description
  Accessible without login Plain text file intercept.php Aux. Configuration script

  Files folder image Files (82)  /  src  /  Support  /  src  
File Role Description
Files folder imageExceptions (1 file)
  Plain text file InterceptConfig.php Class Class source
  Plain text file InterceptServiceProvider.php Class Class source

  Files folder image Files (82)  /  src  /  Support  /  src  /  Exceptions  
File Role Description
  Plain text file InterceptException.php Class Class source

  Files folder image Files (82)  /  src  /  Support  /  tests  
File Role Description
Files folder imageExceptions (1 file)
  Accessible without login Plain text file InterceptConfigTest.php Example Example script
  Plain text file InterceptServiceProviderTest.php Class Class source

  Files folder image Files (82)  /  src  /  Support  /  tests  /  Exceptions  
File Role Description
  Plain text file InterceptExceptionTest.php Class Class source

  Files folder image Files (82)  /  tests  
File Role Description
Files folder imageArchitecture (2 files)
  Plain text file Pest.php Class Class source
  Plain text file TestCase.php Class Class source

  Files folder image Files (82)  /  tests  /  Architecture  
File Role Description
  Plain text file ClassesTest.php Class Class source
  Accessible without login Plain text file GlobalsTest.php Example Example script

  Files folder image Files (82)  /  tools  
File Role Description
  Accessible without login Plain text file create-repos.sh Data Auxiliary data
  Accessible without login Plain text file lib.sh Data Auxiliary data
  Accessible without login Plain text file README.md Doc. Documentation
  Accessible without login Plain text file release-root.sh Data Auxiliary data
  Accessible without login Plain text file release.sh Data Auxiliary data
  Accessible without login Plain text file split.sh Data Auxiliary data
  Accessible without login Plain text file update-repo-descriptions.sh Data Auxiliary data
  Accessible without login Plain text file validate-packages.sh Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads  
 100%
Total:0
This week:0