PHPackages                             awuxtron/options-object - 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. awuxtron/options-object

ActiveLibrary

awuxtron/options-object
=======================

The Options Object Pattern Implement For PHP.

0.0.1-RC1(3y ago)012MITPHP

Since May 20Pushed 3y ago1 watchersCompare

[ Source](https://github.com/awuxtron/options-object)[ Packagist](https://packagist.org/packages/awuxtron/options-object)[ Docs](https://github.com/awuxtron/options-object)[ RSS](/packages/awuxtron-options-object/feed)WikiDiscussions master Synced 1mo ago

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

Them getter cho attribute. (transform) setter, getter, if object call inside another object, pass parent object to attribute

option from method must start with get and set dot notation required option (can set default option in constructor) alias of attribute

rename replace method.

thu tu cua attribute, khi lay default value se transform theo thu tu.

options in constructor is default value. readonly required

set case insensiti

xuly neu khong co type, hoac khong co default value.

### Usage

[](#usage)

```
use Awuxtron\OptionsObject\Attributes\AsOptionsObject;
use Awuxtron\OptionsObject\OptionsObject;

#[AsOptionsObject('a', AnotherOptionsObject::class)]
class Options extends OptionsObject
{
    public int $require_option;
    public int $optional_option = 0;
    public ?int $optional_option_2 = null;
    public mixed $another;

    protected function advanced_option(Example|array $value)
    {
        return $value instanceof Example ? $value : new Example($value);
    }

    protected function nested_option()
    {
        return new class extends OptionsObject {
            // Some options.
        }
    }

    protected function __symlink(): array
    {
        return ['a' => ['b', 'default']];
    }
}
```

```
$options = new Options();
```

```
echo $options->foo;
echo $options->foo->bar;
echo $options['foo'];
echo $options['foo']['bar'];
```

```
$options->foo = 'bar';
$options['foo'] = 'bar';
$options['foo']['bar'] = 'John Doe';
```

```
$options->merge($newConfig);
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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

1459d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c7e6292f4bfd1b15ad7f536161972ac1596d70f6dfe6b9f8dc42d63ce0f7fc05?d=identicon)[awuxtron](/maintainers/awuxtron)

---

Top Contributors

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

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/awuxtron-options-object/health.svg)

```
[![Health](https://phpackages.com/badges/awuxtron-options-object/health.svg)](https://phpackages.com/packages/awuxtron-options-object)
```

###  Alternatives

[symfony/routing

Maps an HTTP request to a set of configuration variables

7.6k789.4M1.8k](/packages/symfony-routing)[twig/twig

Twig, the flexible, fast, and secure template language for PHP

8.4k443.2M5.8k](/packages/twig-twig)[symfony/config

Helps you find, load, combine, autofill and validate configuration values of any kind

4.3k455.2M6.6k](/packages/symfony-config)[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k431.1M7.5k](/packages/symfony-dependency-injection)[zircote/swagger-php

Generate interactive documentation for your RESTful API using PHP attributes (preferred) or PHPDoc annotations

5.3k132.9M468](/packages/zircote-swagger-php)[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

2.9k404.0M702](/packages/league-commonmark)

PHPackages © 2026

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