PHPackages                             bettrlife/schmancy-oo - 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. bettrlife/schmancy-oo

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

bettrlife/schmancy-oo
=====================

Fancy schmancy object-oriented utilities.

053PHP

Since Nov 12Pushed 10y ago2 watchersCompare

[ Source](https://github.com/BettrLife/schmancy-oo)[ Packagist](https://packagist.org/packages/bettrlife/schmancy-oo)[ RSS](/packages/bettrlife-schmancy-oo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

SchmancyOO: Fancy-Schmancy OO Utilities
=======================================

[](#schmancyoo-fancy-schmancy-oo-utilities)

SchmancyOO provides some Lisp-inspired OO utilities that might make your life easier.

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

[](#installation)

```
composer install bettrlife/schmancy-oo
```

Class MethodCombinator
----------------------

[](#class-methodcombinator)

A method combinator allows you to provide automatic method combinations. (A method combination is basically just a way of calling all the methods in the class hierarchy.)

As an example, imagine you have the following:

```
class A {
	function M() { return 1; }
}
class B extends A {}
class C extends B {
	function M() { return 2; }
}
```

A method combination using the function ‘+’ would invoke C-&gt;m(), then invoke A-&gt;m(), and add the results. To wit:

```
(new MethodCombinator(0, function ($x, $y) { $x + $y; }))
	->invoke('M', new C());
// => 3
```

Contrast that with PHP’s “standard” method combination where you would have to write something more like:

```
class A {
	function M() { return 1; }
}
class B extends A {}
class C extends B {
	function M() { return 2 + parent::M(); }
}
```

Which isn’t terribly onerous in this example, but is really annoying and error-prone as the combinator function gets more complicated or you start adding in traits-as-mixins.

### new MethodCombinator($iv, $op, $includeTraits = MethodCombinator::ExcludeTraits)

[](#new-methodcombinatoriv-op-includetraits--methodcombinatorexcludetraits)

Creates a new method combinator. Pass it an initial value, a combinator (callback), and (optionally) whether you’d like to include traits in the MRO.

### Method execute($class, $methodName, $instance = null, $args = \[\])

[](#method-executeclass-methodname-instance--null-args--)

Run a method combination against a class instance (or null, for static methods).

### Method invoke($methodName, $instance, $args = \[\])

[](#method-invokemethodname-instance-args--)

Shorthand for -&gt;execute() where $class is the class of the instance.

Class C3Linearization
---------------------

[](#class-c3linearization)

Implements the [C3 Linearization](http://en.wikipedia.org/wiki/C3_linearization) algorithm. While you are unlikely to use this directly, it’s the underpinnings of other things provided by this library, and is useful if you want to build your own utilities.

### mro(ReflectionClass $class)

[](#mroreflectionclass-class)

Given a class, returns an array of classes and traits defining the order in which methods should be tried (the “method resolution order”).

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/28968debd70ae4c8d47293bf0b93ff92dde0b2fe0c6d0bd62603af65672d9f20?d=identicon)[mjhoag](/maintainers/mjhoag)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/bettrlife-schmancy-oo/health.svg)

```
[![Health](https://phpackages.com/badges/bettrlife-schmancy-oo/health.svg)](https://phpackages.com/packages/bettrlife-schmancy-oo)
```

PHPackages © 2026

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