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. [Utility &amp; Helpers](/categories/utility)
4. /
5. awuxtron/options-object

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

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

The Options Object Pattern Implement For PHP.

0.0.1-RC1(4y ago)012MITPHP

Since May 20Pushed 4y 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 today

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

1504d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/96488794?v=4)[Diep Dang](/maintainers/awuxtron)[@awuxtron](https://github.com/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/dependency-injection

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

4.2k455.6M9.5k](/packages/symfony-dependency-injection)[symfony/config

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

4.3k479.6M8.4k](/packages/symfony-config)[guzzlehttp/guzzle

Guzzle is a PHP HTTP client library

23.5k1.0B35.2k](/packages/guzzlehttp-guzzle)[symfony/service-contracts

Generic abstractions related to writing services

2.6k914.7M604](/packages/symfony-service-contracts)[symfony/options-resolver

Provides an improved replacement for the array\_replace PHP function

3.2k525.7M2.0k](/packages/symfony-options-resolver)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k251.7M11.5k](/packages/symfony-framework-bundle)

PHPackages © 2026

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