Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bnabriss/php-writer


https://github.com/bnabriss/php-writer

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# php-writer

#### via composer

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

(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();

```