bassam-nab / php-writer
write php files using php.
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/bassam-nab/php-writer
Requires (Dev)
- phpunit/phpunit: ^6.5
README
via composer
composer require bassam-nab/php-writer
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();