PHPackages                             mawebdk/to-string-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. mawebdk/to-string-builder

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

mawebdk/to-string-builder
=========================

Builder class for \_\_toString() methods.

2.0.1(10mo ago)062BSD-2-ClausePHPPHP ^8.3.6

Since Sep 2Pushed 10mo agoCompare

[ Source](https://github.com/mawebdk/to-string-builder)[ Packagist](https://packagist.org/packages/mawebdk/to-string-builder)[ RSS](/packages/mawebdk-to-string-builder/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (1)Versions (4)Used By (2)

ToStringBuilder
===============

[](#tostringbuilder)

Builder class for \_\_toString() methods.

Usage
-----

[](#usage)

Sample usage in a \_\_toString() method:

```
public function __toString(): string
{
    $toStringBuilder = new ToStringBuilder(object: $this);

    return $toStringBuilder
        ->add('firstname', $this->firstname)
        ->add('lastname', $this->lastname)
        ->add('age', $this->age)
        ->build();
    }
}

```

Sample output:

```
Namespace\Classname{"firstname": "John", "lastname": "Doe", "age": 18}

```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance55

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

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

Total

3

Last Release

303d ago

Major Versions

1.0.0 → 2.0.02025-09-04

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/176606063?v=4)[mawebdk](/maintainers/mawebdk)[@mawebdk](https://github.com/mawebdk)

---

Top Contributors

[![mawebdk](https://avatars.githubusercontent.com/u/176606063?v=4)](https://github.com/mawebdk "mawebdk (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mawebdk-to-string-builder/health.svg)

```
[![Health](https://phpackages.com/badges/mawebdk-to-string-builder/health.svg)](https://phpackages.com/packages/mawebdk-to-string-builder)
```

###  Alternatives

[wordpress/phpdoc-parser

Static code parser for WordPress source.

23920.0k](/packages/wordpress-phpdoc-parser)[adrhumphreys/silverstripe-textdropdownfield

A text field combined with a dropdown field.

106.4k](/packages/adrhumphreys-silverstripe-textdropdownfield)[webdevstudios/cmb2-user-select

Special CMB2 Field that allows users to define an autocomplete text field for users

211.3k1](/packages/webdevstudios-cmb2-user-select)

PHPackages © 2026

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