PHPackages                             bassam-nab/php-writer - 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. bassam-nab/php-writer

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

bassam-nab/php-writer
=====================

write php files using php.

1.1(8y ago)013MITPHP

Since Feb 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/bnabriss/php-writer)[ Packagist](https://packagist.org/packages/bassam-nab/php-writer)[ RSS](/packages/bassam-nab-php-writer/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (1)Versions (6)Used By (0)

php-writer
==========

[](#php-writer)

#### via composer

[](#via-composer)

```
composer require bassam-nab/php-writer

```

#### example

[](#example)

```
        (new PhpWriter())
            ->openClass('Models\Payment', function (PhpWriter $doc) {
                return $doc
                    ->addUse('SomeTrait')
                    ->addConstant('STATUS_PENDING', 1)
                    ->addConstant('STATUS_REJECTED', 2)
                    ->addConstant('STATUS_ACCEPTED', 3)
                    ->addLine()
                    ->addVar('payment_id')
                    ->addVar('numberOfPayments', 0, 'public', true)
                    ->addLine()
                    ->addMethod('doPay', ['$transaction_id', '...$otherOrders'], 'public', true)
                    ->addMethod('setPrice', ['$price' => 0]);
            }, 'SomeClass', ['myInterface', 'AndOtherInterface'])->exportFile();

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

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

Total

5

Last Release

3010d ago

PHP version history (2 changes)1.0PHP ^5.5

1.0.2PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/89593d871bee9f13f782ff2ddd9f8ed8eb2b60c721aa2d6eac6f0b07d7dde1da?d=identicon)[bnabriss](/maintainers/bnabriss)

---

Top Contributors

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

---

Tags

phpwriter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bassam-nab-php-writer/health.svg)

```
[![Health](https://phpackages.com/badges/bassam-nab-php-writer/health.svg)](https://phpackages.com/packages/bassam-nab-php-writer)
```

###  Alternatives

[suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.4 or later.

2651.4M20](/packages/suin-php-rss-writer)[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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