PHPackages                             jcstrandburg/extension-methods - 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. jcstrandburg/extension-methods

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

jcstrandburg/extension-methods
==============================

Extension method library

v1.1(7y ago)0261MITPHPPHP ^7.0

Since Sep 16Pushed 7y ago1 watchersCompare

[ Source](https://github.com/jcstrandburg/ExtensionMethods)[ Packagist](https://packagist.org/packages/jcstrandburg/extension-methods)[ RSS](/packages/jcstrandburg-extension-methods/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (3)Used By (1)

ExtensionMethods
================

[](#extensionmethods)

This library supports C# and kotlin style extension methods for any class that uses the `Extensible` trait. This library differs from some other libraries in that it is not possible for extension methods to get access to private properties and methods, allowing library authors to maintain proper encapsulation.

Installing
----------

[](#installing)

`composer require jcstrandburg\extension-methods`

Usage
-----

[](#usage)

```
class Person
{
  use trait Extensible;

  public function __construct(string $firstname, string $lastname) {
    $this->firstname = $firstname;
    $this->lastname = $lastname;
  }

  public function getFirstname() {
    return $this->firstname;
  }

  public function getLastname() {
    return $this->lastname;
  }

  private $firstname;
  private $lastname;
}

Person::extend('getFullname', function (Person $x) {
  return $x->getFirstname() . ' ' . $x->getLastname();
});

$bob = new Person('Bob', 'Roberts');
$bob->getFullname() == 'Bob Roberts';
```

Version History
---------------

[](#version-history)

### Unreleased

[](#unreleased)

### 1.1

[](#11)

#### Changed

[](#changed)

- Reworked internal implementation to fix several issues with inheritance. It is now possible to register extension methods for classes extending a base class with the `Extensible` trait even if the extending class itself doesn't have the `Extensible` trait.

### 1.0

[](#10)

#### Added

[](#added)

- `Extensible` trait

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

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

Every ~49 days

Total

2

Last Release

2794d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6415841?v=4)[Justin Strandburg](/maintainers/jcstrandburg)[@jcstrandburg](https://github.com/jcstrandburg)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jcstrandburg-extension-methods/health.svg)

```
[![Health](https://phpackages.com/badges/jcstrandburg-extension-methods/health.svg)](https://phpackages.com/packages/jcstrandburg-extension-methods)
```

###  Alternatives

[humanmade/hm-rewrite

HM\_Rewrite is a wrapper for the WordPress WP Rewrite system. http://hmn.md/wordpress-rewrite-rules-hm-core-style/

16016.4k](/packages/humanmade-hm-rewrite)[heyupdate/emoji

Convert unicode and named (i.e. :smile:) Emoji into images

55103.8k3](/packages/heyupdate-emoji)[shel/blog

A blog package for Neos CMS based on fusion AFX. Also supports atom feeds and AMP.

125.2k](/packages/shel-blog)

PHPackages © 2026

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