PHPackages                             hackpack/hacktions - 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. hackpack/hacktions

ActiveLibrary

hackpack/hacktions
==================

Event library written in hacklang

v1.1.1(12y ago)51.2kMITPHP

Since May 20Pushed 12y ago2 watchersCompare

[ Source](https://github.com/HackPack/hacktions)[ Packagist](https://packagist.org/packages/hackpack/hacktions)[ RSS](/packages/hackpack-hacktions/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Hacktions
=========

[](#hacktions)

> "hacktions speak louder than words"

Events for Hacklang

Usage
-----

[](#usage)

Hacktions exposes two traits:

\##EventEmitter

Run of the mill event emitter with hack type safety.

```
class MyEmitter
{
   use EventEmitter;
}

$emitter = new MyEmitter();

//listeners all use variable argument signatures
$lambda = (...) ==> print(func_get_args()[0]);
$emitter->on('myevent', $lambda);

//trigger fires all registered events with the given name - can take variable arguments
$emitter->trigger('myevent', 'brian');

$emitter->off('myevent', $lambda); //remove a single listener
$emitter->removeListeners(); //remove all listeners
$emitter->removeListeners('myevent') //remove all 'myevent' events
```

\##Subject

Hacktions supports explicit subject/observer relationships:

```
class Cook
{
    //Cook notifies Waiter objects
    use Subject;

    protected Vector $cookedBurgers = {};

    public function cook(Burger $burger): void
    {
        $this->cookedBurgers->add($burger);
        $this->notifyObservers();
    }

    //implement methods to work on cooked items...
}

class Waiter implements Observer
{
    //Waiter observes a cook
    public function update(Cook $cook, ...): void
    {
        $burger = $cook->orderUp();
        //deliver burger...
    }
}
```

The Subject has the following methods:

\###registerObserver(T $observer): void

Registers a new observer with the subject.

\###removeObserver(T $observer): void

Removes the specified object from the list of observers.

\###notifyObservers(...): void

Notify all observers of a change and optionally pass additional data.

\##Running tests

Tests are written using [HackUnit](https://github.com/HackPack/HackUnit). They can be run with the following:

```
bin/hackunit Tests/

```

\##hhi As always, make sure to copy hhi files to the project directory if type checking is desired:

```
cp -r /usr/share/hhvm/hack/hhi /path/to/hacktions

```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

3

Last Release

4381d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f71e23eec19a24f64f37c622e76e725c9a580f83ff40c411da9bad97e0a49089?d=identicon)[brianium](/maintainers/brianium)

---

Top Contributors

[![brianium](https://avatars.githubusercontent.com/u/636651?v=4)](https://github.com/brianium "brianium (15 commits)")

---

Tags

eventshhvmhack

### Embed Badge

![Health badge](/badges/hackpack-hacktions/health.svg)

```
[![Health](https://phpackages.com/badges/hackpack-hacktions/health.svg)](https://phpackages.com/packages/hackpack-hacktions)
```

PHPackages © 2026

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