xylemical/code-writer-twig

A twig code writing library.

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

This package is auto-updated.

Last update: 2024-04-29 04:59:51 UTC


README

Simple writer of code structures using twig templating.

Install

The recommended way to install this library is through composer.

composer require xylemical/code-writer-twig

Usage

Example writer:

<?php

use Xylemical\Code\Writer\Twig\TwigWriter;

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

$loader = new FilesystemLoader("templates");
$twig = new Environment($loader, ['debug' => TRUE]);
$twig->addExtension(new DebugExtension());
$engine = new TwigWriter($twig);

echo $engine->write($class);

License

MIT, see LICENSE.