Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bnabriss/php-writer
https://github.com/bnabriss/php-writer
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/bnabriss/php-writer
- Owner: bnabriss
- Created: 2018-02-15T10:44:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-02-15T17:59:21.000Z (over 6 years ago)
- Last Synced: 2024-04-25T11:41:56.745Z (7 months ago)
- Language: PHP
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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();
```