PHPackages                             webappid/lazy - 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. webappid/lazy

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

webappid/lazy
=============

A lightweight utility for copying data between arrays and PHP objects, with optional type autocasting.

3.1.1(10mo ago)11874MITPHPPHP &gt;=8.0.0

Since Sep 13Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/webappid/lazy)[ Packagist](https://packagist.org/packages/webappid/lazy)[ RSS](/packages/webappid-lazy/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (10)Dependencies (1)Versions (18)Used By (4)

Lazy
====

[](#lazy)

**Lazy** is a simple PHP library that allows you to transform data from JSON arrays into PHP objects (POPOs), or copy data between two PHP classes with ease — optionally with type autocasting.

---

🚀 Features
----------

[](#-features)

- Transform associative arrays (e.g., from JSON) into PHP objects
- Copy data from one PHP object to another
- Autocast values to match property types using docblocks
- Lightweight, no external dependencies

---

🧱 Example: Array to Object
--------------------------

[](#-example-array-to-object)

Suppose you have the following array:

```
$profileArray = [
    'name' => 'John Doe',
    'age' => '17'
];
```

And a plain PHP class (POPO) like this:

```
