PHPackages                             xp-lang/php-compact-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. xp-lang/php-compact-methods

ActiveLibrary

xp-lang/php-compact-methods
===========================

Compact methods for PHP

v2.0.0(2y ago)14.0k↑500%BSD-3-ClausePHPPHP &gt;=7.4.0CI passing

Since Sep 9Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/xp-lang/php-compact-methods)[ Packagist](https://packagist.org/packages/xp-lang/php-compact-methods)[ Docs](http://xp-framework.net/)[ RSS](/packages/xp-lang-php-compact-methods/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (3)Versions (8)Used By (0)

Compact methods for PHP
=======================

[](#compact-methods-for-php)

[![Build status on GitHub](https://github.com/xp-lang/php-compact-methods/workflows/Tests/badge.svg)](https://github.com/xp-lang/php-compact-methods/actions)[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)[![Requires PHP 7.4+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_4plus.svg)](http://php.net/)[![Supports PHP 8.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-8_0plus.svg)](http://php.net/)[![Latest Stable Version](https://camo.githubusercontent.com/58e5113d7b4e633eab5eb39141e2efeea74426fb9da39790bb36b68157b18d93/68747470733a2f2f706f7365722e707567782e6f72672f78702d6c616e672f7068702d636f6d706163742d6d6574686f64732f76657273696f6e2e737667)](https://packagist.org/packages/xp-lang/php-compact-methods)

Plugin for the [XP Compiler](https://github.com/xp-framework/compiler/) which adds compact methods to the PHP language.

Example
-------

[](#example)

Compact methods use the `fn` keyword, much like [PHP 7.4 arrow functions](https://wiki.php.net/rfc/arrow_functions_v2). The RFC suggests this in its *Future Scope* section.

```
class Person {
  private $name;

  public fn name(): string => $this->name;
}
```

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

[](#installation)

After installing the XP Compiler into your project, also include this plugin.

```
$ composer require xp-framework/compiler
# ...

$ composer require xp-lang/php-compact-methods
# ...
```

No further action is required.

See also
--------

[](#see-also)

-
-
- [https://wiki.php.net/rfc/arrow\_functions\_v2#allow\_arrow\_notation\_for\_real\_functions](https://wiki.php.net/rfc/arrow_functions_v2#allow_arrow_notation_for_real_functions)
- [xp-framework/rfc#241](https://github.com/xp-framework/rfc/issues/241)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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 ~276 days

Recently: every ~394 days

Total

7

Last Release

776d ago

Major Versions

v0.2.0 → v1.0.02019-11-30

v1.1.2 → v2.0.02024-03-24

PHP version history (3 changes)v0.1.0PHP &gt;=5.6.0

v1.0.0PHP &gt;=7.0.0

v2.0.0PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/07d18d882c8b4aaf3466432f64018214f2771eda333202175431ee7233795376?d=identicon)[thekid](/maintainers/thekid)

---

Top Contributors

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

---

Tags

arrow-functionscompactcompiler-pluginphp7php8xp-compilerxp-frameworklanguagemodulexp

### Embed Badge

![Health badge](/badges/xp-lang-php-compact-methods/health.svg)

```
[![Health](https://phpackages.com/badges/xp-lang-php-compact-methods/health.svg)](https://phpackages.com/packages/xp-lang-php-compact-methods)
```

PHPackages © 2026

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