PHPackages                             lgse/php-object-builder - 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. lgse/php-object-builder

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

lgse/php-object-builder
=======================

PHP 7.1+ Object Builder

v1.9(6y ago)2202MITPHPPHP &gt;=7.1

Since Jun 5Pushed 6y ago1 watchersCompare

[ Source](https://github.com/lgse/php-object-builder)[ Packagist](https://packagist.org/packages/lgse/php-object-builder)[ Docs](https://github.com/lgse/php-object-builder)[ RSS](/packages/lgse-php-object-builder/feed)WikiDiscussions master Synced 3d ago

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

PHP Object Builder
==================

[](#php-object-builder)

PHP 7+ Recursive Object Builder

About
-----

[](#about)

**PHP Object Builder** will validate instantiate recursively all of your complex objects by passing in an array of values.

Features
--------

[](#features)

- Validates argument types
- Passes arguments to constructors in the right order
- Instantiates parameter classes
- Lightning Fast
- Easy to use

Install
-------

[](#install)

```
composer require php-object-builder
```

Usage
-----

[](#usage)

```
use PHPOB\Model;
use PHPOB\ObjectBuilder;

/**
 * Example Object Class To Instantiate
 * Extending our `Model` class will add the `getInstance` static method
 * to your object so you don't have to create an object builder every
 * time you want to instantiate a class.
 */
class Customer extends Model {
    public function __construct(
        int $id,
        string $name,
        Address $address
    ) {
        $this->id = $id;
        $this->name = $name;
        $this->address = $address;
    }
    ...
}
class Address {
    public function __construct(
        string $street,
        string $city,
        string $state,
        int $zip
    ) {
        $this->street = $street;
        $this->city = $city;
        $this->state = $state;
        $this->zip = $zip;
    }
    ...
}

/**
 * Example instantiation using the `getInstance` static method
 */
$customer = Customer::getInstance([
    'id' => '0e2c0f21-2c46-4cf9-ad7e-2beeadb9282b',
    'name' => 'Microsoft',
    'address' => [
        'street' => '1 Microsoft Way',
        'city' => 'Redmond',
        'state' => 'WA',
        'zip' => 98052,
    ]
]);

/**
 * Example instantiation using the object builder
 * Note: You can pass in instantiated parameters that will be automatically passed through
 * to the object's constructor
 */
 $builder = new ObjectBuilder(Customer::class);
 $customer = $builder->getObject([
    'id' => '0e2c0f21-2c46-4cf9-ad7e-2beeadb9282b',
    'name' => 'Microsoft',
    'address' => new Address([
        'street' => '1 Microsoft Way',
        'city' => 'Redmond',
        'state' => 'WA',
        'zip' => 98052,
    ])
 ]);
```

API
---

[](#api)

### Available methods for Model:

[](#available-methods-for-model)

- `static getInstance(array|object $arguments)` Automatically creates a builder object and returns an instance of extended class.

### Available methods for ObjectBuilder:

[](#available-methods-for-objectbuilder)

- `__construct(string $className)` Instantiates a builder object for provided class name.
- `getObject(array $arguments)` Returns an instantiated object using an array of arguments.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

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

Recently: every ~199 days

Total

10

Last Release

2380d ago

PHP version history (2 changes)v1.0PHP &gt;=7.0

v1.7PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a802102aa155a7660b7402a92e3e48e918276c7a16827e0c5de9c466ab4728d?d=identicon)[l0gicgate](/maintainers/l0gicgate)

---

Top Contributors

[![l0gicgate](https://avatars.githubusercontent.com/u/6510935?v=4)](https://github.com/l0gicgate "l0gicgate (15 commits)")

---

Tags

objectbuilder

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lgse-php-object-builder/health.svg)

```
[![Health](https://phpackages.com/badges/lgse-php-object-builder/health.svg)](https://phpackages.com/packages/lgse-php-object-builder)
```

###  Alternatives

[myclabs/deep-copy

Create deep copies (clones) of your objects

8.9k849.8M169](/packages/myclabs-deep-copy)[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k295.3M2.5k](/packages/symfony-property-access)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k9.2M108](/packages/cuyz-valinor)[kris/laravel-form-builder

Laravel form builder - symfony like

1.7k2.2M45](/packages/kris-laravel-form-builder)[gherkins/regexpbuilderphp

PHP port of thebinarysearchtree/regexpbuilderjs

1.4k163.0k1](/packages/gherkins-regexpbuilderphp)[outl1ne/nova-menu-builder

This Laravel Nova package allows you to create and manage menus and menu items.

243246.0k3](/packages/outl1ne-nova-menu-builder)

PHPackages © 2026

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