PHPackages                             bephp/observable - 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. bephp/observable

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

bephp/observable
================

A observable trait

v0.1(10y ago)138MITPHPPHP &gt;=5.4.0

Since Apr 15Pushed 9y ago1 watchersCompare

[ Source](https://github.com/bephp/observable)[ Packagist](https://packagist.org/packages/bephp/observable)[ Docs](https://github.com/lloydzhou/observable)[ RSS](/packages/bephp-observable/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

observable
==========

[](#observable)

[![Build Status](https://camo.githubusercontent.com/f4c3bab5721a45a53cb24e310559f9e6fc0713ba4f1d5bc5fc429c644bb5b867/68747470733a2f2f7472617669732d63692e6f72672f62657068702f6f627365727661626c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bephp/observable)[![Coverage Status](https://camo.githubusercontent.com/51863e285300a2ae8029bfd7006e9e1edd108c431c938963606e7da6c2570fe9/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f62657068702f6f627365727661626c652f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/bephp/observable?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/2376a1beb684d49d93122c2bfe0fcbbd0cdb5feff24ed2236588a1bf33053ab4/68747470733a2f2f706f7365722e707567782e6f72672f62657068702f6f627365727661626c652f762f737461626c65)](https://packagist.org/packages/bephp/observable)[![Total Downloads](https://camo.githubusercontent.com/6d15cbb95bffa653b4ca42a2416f08b9f27ddb4f461920a23c111defd3d68e29/68747470733a2f2f706f7365722e707567782e6f72672f62657068702f6f627365727661626c652f646f776e6c6f616473)](https://packagist.org/packages/bephp/observable)[![Latest Unstable Version](https://camo.githubusercontent.com/4187dae2c5340127aed9214b199ad02604c7dc06527fb81339e9dccb7161a6df/68747470733a2f2f706f7365722e707567782e6f72672f62657068702f6f627365727661626c652f762f756e737461626c65)](https://packagist.org/packages/bephp/observable)[![License](https://camo.githubusercontent.com/802b3f81f595981cbad81ff3b31f3324babe8e773ffa211313450ac8744eba76/68747470733a2f2f706f7365722e707567782e6f72672f62657068702f6f627365727661626c652f6c6963656e7365)](https://packagist.org/packages/bephp/observable)

*A observable triat for PHP.*

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

[](#installation)

```
composer require bephp/observable

```

API Reference
-------------

[](#api-reference)

### on($event, $cb)

[](#onevent-cb)

add event

### off($event)

[](#offevent)

remove event

### trigger()

[](#trigger)

trigger event

Example
-------

[](#example)

```
class A{
    use Observable;
}
$a = new A();
$a->on('hello', function($name){
    echo 'hello ', $name, '!';
});
$a->trigger('hello', 'lloyd');

```

this demo will get result:

```
hello lloyd!

```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

3721d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5fe53a9780d36da291ceab6e1741680db86d0b40198cae9435c12044abfefabd?d=identicon)[lloydzhou](/maintainers/lloydzhou)

---

Top Contributors

[![lloydzhou](https://avatars.githubusercontent.com/u/1826685?v=4)](https://github.com/lloydzhou "lloydzhou (7 commits)")

---

Tags

microlibrarytrait

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bephp-observable/health.svg)

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

###  Alternatives

[nette/robot-loader

🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.

89354.3M346](/packages/nette-robot-loader)[league/iso3166

ISO 3166-1 PHP Library

69837.6M135](/packages/league-iso3166)[devster/ubench

Micro PHP library for benchmarking

5641.0M33](/packages/devster-ubench)[dekor/php-array-table

PHP Library for printing associative arrays as text table (similar to mysql terminal console)

297.4M2](/packages/dekor-php-array-table)[ebidtech/collection

A set of interfaces and traits to speed up the creation of collections

13122.3k6](/packages/ebidtech-collection)

PHPackages © 2026

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