PHPackages                             slaxweb/hooks - 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. [Framework](/categories/framework)
4. /
5. slaxweb/hooks

ActiveLibrary[Framework](/categories/framework)

slaxweb/hooks
=============

Hooks library for SlaxWeb Framework

0.6.0(9y ago)09723MITPHPPHP &gt;=7.0.0

Since Feb 9Pushed 9y ago1 watchersCompare

[ Source](https://github.com/SlaxWeb/Hooks)[ Packagist](https://packagist.org/packages/slaxweb/hooks)[ RSS](/packages/slaxweb-hooks/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (8)Used By (3)

Hooks
=====

[](#hooks)

[![Build Status](https://camo.githubusercontent.com/e233411f9e0a5a046e70622a63629016bdd98e713e72b920b77e643d6a0a99c3/68747470733a2f2f7472617669732d63692e6f72672f536c61785765622f486f6f6b732e7376673f6272616e63683d302e342e30)](https://travis-ci.org/SlaxWeb/Hooks)

Hooks component for the SlaxWeb/Framework, to execute arbitrary code in regular application execution. Even when the component is meant for the SlaxWeb/Framework it can be used outside of it as well. It the SlaxWeb/Logger as an additional component.

For ease of use the component provides a Factory and a Service Provider for the Pimple/Container.

Installation
------------

[](#installation)

Easiest form of installation is through composer, edit your *composer.json* file to contain:

```
{
    "require": {
        "slaxweb/hooks": "~0.5.*@dev"
    },
    "minimum-stability": "dev"
}
```

Usage
-----

[](#usage)

This section will cover instantiation of the Hooks container, and adding simple hook definitions to the container, as well as execution of this definition, and advanced execution of hook definitions.

### Instantiation

[](#instantiation)

You do not need to instantiate the Logger component it self, but you do have to instantiate the Config component, and make sure that the logger configuration is loaded, refer to [Logger documentation](https://github.com/SlaxWeb/Logger/) on how to get this done.

When you got the dependencies instantiated the usage is pretty straight forward:

```
