PHPackages                             nabeghe/file-hooker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. nabeghe/file-hooker

ActiveLibrary

nabeghe/file-hooker
===================

Hooking system based on files.

v1.1.0(11mo ago)413MITPHPPHP &gt;=7.4

Since Feb 15Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/nabeghe/php-file-hooker)[ Packagist](https://packagist.org/packages/nabeghe/file-hooker)[ Docs](https://github.com/nabeghe/php-file-hooker)[ RSS](/packages/nabeghe-file-hooker/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

File Hooker for PHP
===================

[](#file-hooker-for-php)

 [![](https://private-user-images.githubusercontent.com/12207627/452811831-bb4bee9b-66c5-4109-ad9c-723c1afe6ddb.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ2MTU0NTcsIm5iZiI6MTc3NDYxNTE1NywicGF0aCI6Ii8xMjIwNzYyNy80NTI4MTE4MzEtYmI0YmVlOWItNjZjNS00MTA5LWFkOWMtNzIzYzFhZmU2ZGRiLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzI3VDEyMzkxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBiNGJhMzAxN2YzMmY5NmJkNDNjYmYxOGY5MDUxYTBmODRiNTgyOWNiZmNjMjgwM2EyMWZkMzIxZTAwY2U2YTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.juPJw2UCiXGgYOz-hzM7wzR_V8xBWJauPu1qkaS1dpY)](https://private-user-images.githubusercontent.com/12207627/452811831-bb4bee9b-66c5-4109-ad9c-723c1afe6ddb.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ2MTU0NTcsIm5iZiI6MTc3NDYxNTE1NywicGF0aCI6Ii8xMjIwNzYyNy80NTI4MTE4MzEtYmI0YmVlOWItNjZjNS00MTA5LWFkOWMtNzIzYzFhZmU2ZGRiLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzI3VDEyMzkxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBiNGJhMzAxN2YzMmY5NmJkNDNjYmYxOGY5MDUxYTBmODRiNTgyOWNiZmNjMjgwM2EyMWZkMzIxZTAwY2U2YTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.juPJw2UCiXGgYOz-hzM7wzR_V8xBWJauPu1qkaS1dpY)

> A simple Hooking System based on files. This means that each callback is located in a PHP file.

🫡 Usage
-------

[](#-usage)

### 🚀 Installation

[](#-installation)

You can install the package via composer:

```
composer require nabeghe/file-hooker
```

### 📁 Hooks Directory

[](#-hooks-directory)

Create a directory for your hooks.

The name of each php file in this directory without suffix (.php) will be the name of your hook. Subdirectories are also allowed.

Each file returns a callback. This callback receives two arguments, data and angler. Data is the items sent to the callback. In filters, it must be an array, but in actions, it can be anything. Index 0 of data in filters is what is filtered. But in callbacks, the array itself must be returned.

### Example

[](#example)

```
