PHPackages                             zikula/hook-bundle - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. zikula/hook-bundle

AbandonedArchivedSymfony-bundle[Utility &amp; Helpers](/categories/utility)

zikula/hook-bundle
==================

An bundle consolidating Extension Hook features.

3.1.0(4y ago)19846MITPHPPHP &gt;=7.2.5

Since Jun 12Pushed 4y ago2 watchersCompare

[ Source](https://github.com/zikula/HookBundle)[ Packagist](https://packagist.org/packages/zikula/hook-bundle)[ Docs](https://ziku.la)[ RSS](/packages/zikula-hook-bundle/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (10)Versions (10)Used By (6)

HookBundle
==========

[](#hookbundle)

This is a read-only repository.

Resources
---------

[](#resources)

- [Report issues](https://github.com/zikula/core/issues) and [send Pull Requests](https://github.com/zikula/core/pulls)in the [main Zikula repository](https://github.com/zikula/core)
- For more information visit [ziku.la](https://ziku.la/).
- Please see our [documentation](https://docs.ziku.la).

What Are Hooks?
===============

[](#what-are-hooks)

- Hooks are events that are dynamically attached to listeners at runtime.
- Hooks are connected to listeners in a User Interface and stored in a DB table.
    - This UI allows the user to connect/disconnect and alter the priority of the connection between the event and the listener.
- Hooks are generically contracted for workflow types.

How are HookEvents different from standard Events?
--------------------------------------------------

[](#how-are-hookevents-different-from-standard-events)

- Events are connected to listeners using EventListeners or EventSubscribers from within the Symfony container and cannot be dynamically assigned at will via a UI.
- Events are uniquely contractural and specific to a single workflow.

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

[](#installation)

- If using this bundle within Zikula, there is no need to do anything, it is automatically installed.
- If using this bundle without Zikula, You must create the database table schema that associates with the `ConnectionEntity` and you must also add this bundle to your `bundles.php` file.

HookEvent Types
---------------

[](#hookevent-types)

The following abstractHookEvents are provided by HookBundle. Additional HookEvents can be easily created as well. Each HookEvent also has a companion HookEventListener that is uniquely paired with that event. This pairing defines the contract between Event and Listener.

1. DisplayHookEvent -&gt; DisplayHookEventListener
2. FilterHookEvent -&gt; FilterHookEventListener
3. FormHookEvent -&gt; FormHookEventListener

### DisplayHookEvent

[](#displayhookevent)

A DisplayHookEvent is dispatched from within a twig template using the provided twig function `{{ dispatchDisplayHookEvent('HookEventClassname', 'id') }}`DisplayHookEventListeners must add `DisplayHookEventResponse` objects which add content to the template at that location. (Example: display comments following a blog article).

### FilterHookEvent

[](#filterhookevent)

A FilterHookEvent is dispatched from withing a twig template using the provided twig filter `{{ targetString|dispatchFilterHookEvent('HookEventClassname') }}`FilterHookEventListeners are provided the target string and this string may be altered (or filtered) as needed. (Example: profanity removal).

### FormHookEvent

[](#formhookevent)

A FormHookEvent is dispatched twice within a Symfony Form workflow inside a controller. First, after the instantiation of the form and then again after the form has been submitted and validated. FormHookEventListeners are provided the target Form and may alter the Form as needed, provide additional templates and then finally process the unbound form data. (Example: adding profile fields to a user registration form, or adding a WYSIWYG editor to textfields).

Implementation
--------------

[](#implementation)

It is quite easy to implement both HookEvents and HookEventListeners. Simply extend the abstract parent class, defining both `title` and `info` properties. It is important that the classes are in an auto-configured directory or are manually tagged `zikula.hook_event` or `zikula.hook_event_listener` respectively.

Listeners require implementing logic needed to affect change as desired. In the `DisplayHookEventListener` and `FilterHookEventListener`, this is done in the `execute` method. In `FormHookEventListener` two methods require logic: `preHandleExecute` for modifying the form before it handles the `Request` and `postSubmitExecute` after the form has been submitted. See all the properties and methods of each class as well as included demonstration code for more information.

Philosophy
----------

[](#philosophy)

Hook Connections are intentionally *generic* and agnostic of the larger application or specific functions surrounding them. Listeners are unaware of the specific controller or template to which they are listening and the content or form to which they may be connected. The listener does not change its behavior/response based upon which controller or template from which the event is dispatched.

This is one aspect of Hooks that makes them unique from Events. If specific knowledge of the workflow or content is required, a custom event is the preferred solution. Instead, HookListeners respond in a generic way to unique HookEvents and provide the same responses anytime that a HookEvent is dispatched. These Listeners can provide the same responses in any location within an application in this generic way.

The contract is based upon the abstract parent HookEvent class not upon the final concrete class. The final concrete classname becomes the unique event name so that the Connections User Interface may identify the location to assign that connection. This is what is meant by generic contract: generic by HookEvent, and the power is in the flexibility this standardization brings.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~70 days

Recently: every ~128 days

Total

9

Last Release

1609d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/05bffe6f4f72d34970f0d8f6682b283bd19fbe8c2b2cc7eda48867a3a7f3db4c?d=identicon)[zikula](/maintainers/zikula)

---

Top Contributors

[![Guite](https://avatars.githubusercontent.com/u/277531?v=4)](https://github.com/Guite "Guite (39 commits)")[![craigh](https://avatars.githubusercontent.com/u/350048?v=4)](https://github.com/craigh "craigh (33 commits)")

---

Tags

zikula

### Embed Badge

![Health badge](/badges/zikula-hook-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/zikula-hook-bundle/health.svg)](https://phpackages.com/packages/zikula-hook-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
