PHPackages                             decodelabs/hatch - 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. decodelabs/hatch

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

decodelabs/hatch
================

Simple code generation tools

v0.1.5(8mo ago)03.4k4MITPHPPHP ^8.4CI passing

Since Mar 10Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/decodelabs/hatch)[ Packagist](https://packagist.org/packages/decodelabs/hatch)[ RSS](/packages/decodelabs-hatch/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (6)Dependencies (3)Versions (8)Used By (4)

Hatch
=====

[](#hatch)

[![PHP from Packagist](https://camo.githubusercontent.com/616bb9b059020da5727020053d016d419e4f5a3c399168424606088a058ee876/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6465636f64656c6162732f68617463683f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/hatch)[![Latest Version](https://camo.githubusercontent.com/b324fd3538c0d310420f9e94ce649edb9dfda3b326ee5119ba6f2c4326017262/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465636f64656c6162732f68617463682e7376673f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/hatch)[![Total Downloads](https://camo.githubusercontent.com/6c43ee5269489a6a9931a276ea9035993cb58c1f9b409c9f3d42ff93f44d9dda/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465636f64656c6162732f68617463682e7376673f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/hatch)[![GitHub Workflow Status](https://camo.githubusercontent.com/049ab011ac88fd3a865b7837830b95767b1c9abf5416860c6f2175eb2e95259a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6465636f64656c6162732f68617463682f696e746567726174652e796d6c3f6272616e63683d646576656c6f70)](https://github.com/decodelabs/hatch/actions/workflows/integrate.yml)[![PHPStan](https://camo.githubusercontent.com/e25c14ce011edabdd0fbd2e10415b41cc5d66ed11ef3e5b7edd074c5bdd35a2d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d3434434331312e7376673f6c6f6e6743616368653d74727565267374796c653d666c6174)](https://github.com/phpstan/phpstan)[![License](https://camo.githubusercontent.com/e1a9701201d84fe0740e6a93527263d19f609852d1fb23822834e9ad8bb473f0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6465636f64656c6162732f68617463683f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/hatch)

### Simple code generation tools

[](#simple-code-generation-tools)

Hatch provides a set of simple tools for generating PHP code.

*Get news and updates on the [DecodeLabs blog](https://blog.decodelabs.com).*

---

Installation
------------

[](#installation)

This package requires PHP 8.4 or higher.

Install via Composer:

```
composer require decodelabs/hatch
```

Usage
-----

[](#usage)

### Static arrays

[](#static-arrays)

Export arrays of data for reuse as config files or static loadable datastructures.

```
use DecodeLabs\Hatch;

$code = Hatch::exportStaticArray([
    'foo' => 'bar',
    'baz' => 'qux',
    'quux' => [
        'corge' => 'grault',
        'garply' => 12,
        'fred' => [
            'plugh' => 'xyzzy',
            'thud' => [1, 2, 3]
        ]
    ]
]);

echo $code;
```

This will output:

```
[
    'foo' => 'bar',
    'baz' => 'qux',
    'quux' => [
        'corge' => 'grault',
        'garply' => 12,
        'fred' => [
            'plugh' => 'xyzzy',
            'thud' => [1, 2, 3]
        ]
    ]
]
```

Licensing
---------

[](#licensing)

Hatch is licensed under the MIT License. See [LICENSE](./LICENSE) for the full license text.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance67

Regular maintenance activity

Popularity19

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity50

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

Every ~38 days

Recently: every ~26 days

Total

6

Last Release

241d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a241d64d12b3b5ee94197862ec1ec30b82ed2efa34a0cd7f4c3565a021daddd?d=identicon)[betterthanclay](/maintainers/betterthanclay)

---

Top Contributors

[![betterthanclay](https://avatars.githubusercontent.com/u/1273586?v=4)](https://github.com/betterthanclay "betterthanclay (26 commits)")

---

Tags

code-generationphp

### Embed Badge

![Health badge](/badges/decodelabs-hatch/health.svg)

```
[![Health](https://phpackages.com/badges/decodelabs-hatch/health.svg)](https://phpackages.com/packages/decodelabs-hatch)
```

###  Alternatives

[litecms/page

Page package for litecms.

1851.8k1](/packages/litecms-page)

PHPackages © 2026

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