PHPackages                             plumbok/plumbok - 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. plumbok/plumbok

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

plumbok/plumbok
===============

Runtime Code Generator like Lombok for PHP

0.10.1(8y ago)626868[1 issues](https://github.com/plumbok/plumbok/issues)MITPHPPHP ^7.1

Since Dec 12Pushed 7y ago4 watchersCompare

[ Source](https://github.com/plumbok/plumbok)[ Packagist](https://packagist.org/packages/plumbok/plumbok)[ RSS](/packages/plumbok-plumbok/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (9)Versions (13)Used By (0)

Plumbok
=======

[](#plumbok)

Runtime Code Generator like Lombok for PHP.

Code generation starts when additional autoloader detects class uses Plumbok annotations and loads newly generated code with added methods in preprocess step.

[![PHP 7.1](https://camo.githubusercontent.com/d29ceb6206232af72a55b5ed3e6fab0a1f2d6cb6c728a088c9c18c4b035a0765/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e312d626c75652e737667)](https://camo.githubusercontent.com/d29ceb6206232af72a55b5ed3e6fab0a1f2d6cb6c728a088c9c18c4b035a0765/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e312d626c75652e737667)[![Build Status](https://camo.githubusercontent.com/47326d9af217a3ff4cbda276cf9da9852c128bf50d4b567c1305830cdea4213c/68747470733a2f2f7472617669732d63692e6f72672f706c756d626f6b2f706c756d626f6b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/plumbok/plumbok)[![GitHub license](https://camo.githubusercontent.com/a3a69368f9e19bc4cf5e4064eb54860cb1102df81b6f6b5c53d1adcb43575ed9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f706c756d626f6b2f706c756d626f6b2e737667)](https://github.com/plumbok/plumbok/blob/master/LICENSE)

---

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

[](#installation)

### Install with Composer

[](#install-with-composer)

```
composer require mjkruszewski/plumbok
```

Usage
-----

[](#usage)

### Using autoloader at runtime on develop

[](#using-autoloader-at-runtime-on-develop)

Registering additional autoloader:

```
require 'vendor/autoload.php';

Plumbok\Autoload::register('Plumbok\\Test');
```

Using annotations in class:

```
namespace Plumbok\Test;

/**
 * @Data
 * @ToString(property = "email")
 */
class Person
{
    /**
     * @var array
     * @Getter @Setter
     */
    private $names = [];

    /**
     * @var string
     * @Getter @Setter
     */
    private $email;

    /**
     * Holds age
     * @var int
     * @Getter @Setter
     */
    private $age;

    /**
     * @var \DateTime
     * @Getter @Setter
     */
    private $birthdate;

    /**
     * @var int[]
     * @Getter @Setter
     */
    private $favouriteNumbers = [1, 7, 14, 21, 28];
}
```

After first run your original code will be little modified with additional docblock ennotations (tags) in PhpDocumentor style.

[![PhpStorm Autocomplete Support](doc/ide-autocomplete.png)](doc/ide-autocomplete.png)

```
namespace Plumbok\Test;

/**
 * @Data
 * @ToString(property = "email")
 * @method void __construct(int $age, \DateTime $birthdate)
 * @method array getNames()
 * @method void setNames(array $names)
 * @method string getEmail()
 * @method void setEmail(string $email)
 * @method string toString()
 * @method int getAge()
 * @method void setAge(int $age)
 * @method \DateTime getBirthdate()
 * @method void setBirthdate(\DateTime $birthdate)
 * @method int[] getFavouriteNumbers()
 * @method void setFavouriteNumbers(int[] $favouriteNumbers)
 */
class Person
{
    /**
     * @var array
     * @Getter @Setter
     */
    private $names = [];

    /**
     * @var string
     * @Getter @Setter
     */
    private $email;

    /**
     * Holds age
     * @var int
     * @Getter @Setter
     */
    private $age;

    /**
     * @var \DateTime
     * @Getter @Setter
     */
    private $birthdate;

    /**
     * @var int[]
     * @Getter @Setter
     */
    private $favouriteNumbers = [1, 7, 14, 21, 28];
}
```

This preprocessing step allows IDE to recognise generated methods from docblock. Second step is including generated code which looks like:

```
namespace Plumbok\Test;

/**
 * @Data
 * @ToString(property = "email")
 */
class Person
{
    /**
     * @var array
     * @Getter @Setter
     */
    private $names = [];
    /**
     * Holds age
     * @var int
     * @Getter @Setter
     */
    private $age;
    /**
     * @var \DateTime
     * @Getter @Setter
     */
    private $birthdate;
    /**
     * @var int[]
     * @Getter @Setter
     */
    private $favouriteNumbers = [1, 7, 14, 21, 28];
    /**
     * Person constructor.
     *
     * @param int $age
     * @param \DateTime $birthdate
     */
    public function __construct(int $age, \DateTime $birthdate)
    {
        $this->age = $age;
        $this->birthdate = $birthdate;
    }
    /**
     * Retrieves names
     *
     * @return array
     */
    public function getNames() : array
    {
        return $this->names;
    }
    /**
     * Sets names
     *
     * @param array $names
     * @return void
     */
    public function setNames(array $names)
    {
        $this->names = $names;
    }

    /**
     * Retrieves email
     *
     * @return string
     */
    public function getEmail() : string
    {
        return $this->email;
    }

    /**
     * Sets email
     *
     * @param string $email string
     * @return void
     */
    public function setEmail(string $email)
    {
        return $this->email = $email;
    }

    /**
     * Returns string from $email
     *
     * @return string
     */
    public function toString() : string
    {
        return (string) $this->email;
    }

    /**
     * Retrieves age
     *
     * @return int
     */
    public function getAge() : int
    {
        return $this->age;
    }
    /**
     * Sets age
     *
     * @param int $age
     * @return void
     */
    public function setAge(int $age)
    {
        $this->age = $age;
    }
    /**
     * Retrieves birthdate
     *
     * @return \DateTime
     */
    public function getBirthdate() : \DateTime
    {
        return $this->birthdate;
    }
    /**
     * Sets birthdate
     *
     * @param \DateTime $birthdate
     * @return void
     */
    public function setBirthdate(\DateTime $birthdate)
    {
        $this->birthdate = $birthdate;
    }
    /**
     * Retrieves favouriteNumbers
     *
     * @return int[]
     */
    public function getFavouriteNumbers() : array
    {
        return $this->favouriteNumbers;
    }
    /**
     * Sets favouriteNumbers
     *
     * @param int[] $favouriteNumbers
     * @return void
     */
    public function setFavouriteNumbers(array $favouriteNumbers)
    {
        $this->favouriteNumbers = $favouriteNumbers;
    }
}
```

### Using prebuild command in CLI for test and prod

[](#using-prebuild-command-in-cli-for-test-and-prod)

Use CLI to run `plumbok` executable.

```
bin/plumbok [src-directory] [cache-directory]
```

> Note! This usage still requires adding autoload in bootstrap file!

Using CLI to run `plumbok` executable and replace source code with generated one.

```
bin/plumbok [src-directory] --inline
```

Additional options:

- `--ext`, `-e` pass file extension to look classes for, default `php`
- `--no-tags` won't push `@method` tags into source file
- `--inline` will replace source code with generated one
- `-v|vv|vvv` increases verbosity
- `--help`, `-h` display help

---

License
-------

[](#license)

The MIT License (MIT)

Copyright (c) 2018 Michał Brzuchalski

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

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

Recently: every ~124 days

Total

13

Last Release

2976d ago

PHP version history (2 changes)0.9.1PHP 7.\*

0.10.1PHP ^7.1

### Community

Maintainers

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

---

Top Contributors

[![brzuchal](https://avatars.githubusercontent.com/u/3149753?v=4)](https://github.com/brzuchal "brzuchal (45 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136400.8k14](/packages/rector-rector-src)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9317.2k55](/packages/open-dxp-opendxp)[aeliot/todo-registrar

Register TODOs from source code in issue tracker

153.0k](/packages/aeliot-todo-registrar)

PHPackages © 2026

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