xp-lang/php-compact-methods

Compact methods for PHP

Maintainers

Package info

github.com/xp-lang/php-compact-methods

Homepage

pkg:composer/xp-lang/php-compact-methods

Statistics

Installs: 3 990

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v2.0.0 2024-03-24 12:47 UTC

This package is auto-updated.

Last update: 2026-03-01 00:29:07 UTC


README

Build status on GitHub XP Framework Module BSD Licence Requires PHP 7.4+ Supports PHP 8.0+ Latest Stable Version

Plugin for the XP Compiler which adds compact methods to the PHP language.

Example

Compact methods use the fn keyword, much like PHP 7.4 arrow functions. The RFC suggests this in its Future Scope section.

class Person {
  private $name;

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

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