PHPackages                             selfiens/property-alias - 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. selfiens/property-alias

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

selfiens/property-alias
=======================

Enables property alias via ClassDoc

1.0(7mo ago)133MITPHPPHP &gt;=8.0CI passing

Since Nov 7Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/selfiens/property-alias)[ Packagist](https://packagist.org/packages/selfiens/property-alias)[ RSS](/packages/selfiens-property-alias/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Property Alias
==============

[](#property-alias)

[![PHPUnit Status](https://github.com/selfiens/property-alias/actions/workflows/phpunit.yml/badge.svg)](https://github.com/selfiens/property-alias/actions/workflows/phpunit.yml)

This package enables you to create aliases for existing class properties with a simple ClassDoc setup.

Below is an example of creating an alias to `$this->foo`.

```
/**
 * @property $my_alias = foo
 *              ^
 *              |
 *      This is how you define an alias to "$foo".
 *      Valid PHP identifiers will work, including UTF-8 $한글.
 */
 class MyClass {
    use \Selfiens\PropertyAliasTrait;

    public string $foo = 'foo';
 }
```

Then you can read/write properties via alias.

```
$my = new MyClass();

// read
echo $my->my_alias; // 'foo'

 // write
$my->my_alias = 'bar';
echo $my->foo; // 'bar';
```

Install
-------

[](#install)

```
composer require selfiens/property-alias:^1.0
```

Setup
-----

[](#setup)

This package's `\Selfiens\PropertyAliasTrait` uses ClassDoc as the source of alias definitions. You can create aliases using the `@property` syntax, as shown in the following example:

```
/**
 * @property $alias_name = target_property
 */
```

You can define as many aliases as you desire. Aliases can point to the other aliases.

Background
----------

[](#background)

### Aliases on existing properties

[](#aliases-on-existing-properties)

This package aims to assist in accessing poorly named properties by better names. It is designed to help in situations where you are unable to rename a property due to reasons such as its origin from an external API, a poorly named database field, or the high risk associated with refactoring the name.

### Defining aliases in ClassDoc with @property

[](#defining-aliases-in-classdoc-with-property)

The `@property` definitions in ClassDoc are understood by many IDEs, and these IDEs will provide auto-completions and refactorings as if the aliases were real properties.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance62

Regular maintenance activity

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

238d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2247403?v=4)[Kita](/maintainers/selfiens)[@selfiens](https://github.com/selfiens)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/selfiens-property-alias/health.svg)

```
[![Health](https://phpackages.com/badges/selfiens-property-alias/health.svg)](https://phpackages.com/packages/selfiens-property-alias)
```

###  Alternatives

[nahid/presento

Presento is a package for PHP data presenter

747.3k](/packages/nahid-presento)[t3sbs/t3sbootstrap

Startup extension to use bootstrap 5 classes, components and more out of the box. Example and info: \[www.t3sbootstrap.de\](https://www.t3sbootstrap.de)

2416.4k](/packages/t3sbs-t3sbootstrap)

PHPackages © 2026

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