PHPackages                             scriptmancer/ulak - 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. scriptmancer/ulak

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

scriptmancer/ulak
=================

A modern, attribute-based PHP event system with Result pattern for clean, type-safe event handling

v1.0.0(1y ago)08MITPHPPHP ^8.1

Since Feb 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/scriptmancer/ulak)[ Packagist](https://packagist.org/packages/scriptmancer/ulak)[ RSS](/packages/scriptmancer-ulak/feed)WikiDiscussions main Synced 1mo ago

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

Ulak Event System
=================

[](#ulak-event-system)

A modern, attribute-based PHP event system with Result pattern for clean, type-safe event handling.

Features
--------

[](#features)

- 🎯 Attribute-based event registration with PHP 8.1+ attributes
- 🔄 Clean Success/Failure result pattern with explicit error handling
- 🌟 Async event support with Redis integration
- 🎭 Framework agnostic design
- 🌳 PSR-compatible interfaces
- 🔍 Type-safe event handling with union types
- ⚡ High performance with attribute caching
- 🛡️ Modern PHP 8.1+ features

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Composer
- Redis (for async examples)

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

[](#installation)

```
composer require scriptmancer/ulak
```

Quick Start
-----------

[](#quick-start)

### 1. Basic Event Handling

[](#1-basic-event-handling)

```
use Ulak\Attributes\Event;
use Ulak\Results\{Success, Failure};

class UserService
{
    #[Event('user.registered')]
    #[Event('user.failed', on: 'failure')]
    public function register(array $data): Success|Failure
    {
        if (!$this->validate($data)) {
            return new Failure(new ValidationException('Invalid data'));
        }

        // Registration logic
        return new Success([
            'id' => $userId,
            'email' => $data['email']
        ]);
    }
}
```

### 2. Async Event Processing

[](#2-async-event-processing)

```
use Ulak\Results\AsyncSuccess;

class FileService
{
    #[Event('file.queued', on: 'async')]
    public function processLargeFile(File $file): AsyncSuccess|Failure
    {
        $jobId = uniqid('job-');
        return new AsyncSuccess($file, $jobId)
            ->setProgress(0);
    }
}
```

### 3. Event Listeners

[](#3-event-listeners)

```
use Ulak\EventDispatcher;

$dispatcher = new EventDispatcher();

// Add a simple listener
$dispatcher->addListener('user.registered', function(string $event, array $data) {
    // Handle user registration
});

// Add a high-priority listener
$dispatcher->addListener('user.registered',
    function(string $event, array $data) {
        // Handle with high priority
    },
    EventDispatcher::PRIORITY_HIGH
);
```

Examples
--------

[](#examples)

The repository includes several examples demonstrating different features:

- Basic console event handling
- Async event processing with Redis
- Web-based event handling
- Progress tracking
- Event logging

To run the examples:

```
# Console examples
cd examples/console/basic
php run.php

# Web examples
cd examples/web
php -S localhost:8080
```

Development Setup
-----------------

[](#development-setup)

1. Clone the repository:

```
git clone https://github.com/scriptmancer/ulak.git
cd ulak
```

2. Install dependencies:

```
composer install
```

3. Run tests:

```
composer test
```

Testing
-------

[](#testing)

The project uses Pest PHP for testing:

```
# Run all tests
composer test

# Run with coverage
composer test:coverage
```

Contributing
------------

[](#contributing)

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance43

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

454d ago

### Community

Maintainers

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

---

Top Contributors

[![gsarigul84](https://avatars.githubusercontent.com/u/1032251?v=4)](https://github.com/gsarigul84 "gsarigul84 (1 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/scriptmancer-ulak/health.svg)

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

###  Alternatives

[link1st/laravel-easemob

环信即时通讯laravel包开发，用于环信用户、群、聊天室等功能

456.6k](/packages/link1st-laravel-easemob)[zgb7mtr/phpredis_cluster_phpdoc

@phpdoc extension phpredis cluster for IDE autocomplete

1048.4k](/packages/zgb7mtr-phpredis-cluster-phpdoc)

PHPackages © 2026

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