xylemical/code-php

A PHP code generation library.

dev-master 2022-06-30 05:44 UTC

This package is auto-updated.

Last update: 2024-04-29 05:05:53 UTC


README

Code writer for PHP.

Install

The recommended way to install this library is through composer.

composer require xylemical/code-php

Usage

Example writer using twig (requires xylemical/code-writer-twig):

<?php

use Xylemical\Code\Writer\Twig\TwigRender;

// Structure as created via xylemical/code documentation.
$class = ...;

$loader = new PhpTwigLoader();
$twig = new Environment($loader, ['debug' => TRUE]);
$twig->addExtension(new DebugExtension());
$twig->addExtension(new PhpTwigExtension());
$engine = new TwigRender($twig);

echo $engine->render($class);

License

MIT, see LICENSE.