Skip to content

sidux/php-generator

Repository files navigation

Sidux PHP Generator

Code Analysis Coverage Status Type Coverage Status Dependabot

Introduction

Generate PHP code, classes, namespaces etc. with a simple programmatical API.

Installation

The recommended way to install is via Composer:

composer require sidux/php-generator

Usage

Usage is very easy. Let's start with generating class:

$class = new Sidux\PhpGenerator\Model\Struct('Demo');

$class
    ->setFinal()
    ->setExtends('ParentClass')
    ->addImplement('Countable')
    ->addTrait('Foo\Bar')
    ->addComment("Description of class.\nSecond line\n")
    ->addComment('@property-read Sidux\Forms\Form $form');

// to generate PHP code simply cast to string or use echo:
echo $class;

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages