Skip to content

YACO (Yet Another COmpiler) is a PHP tool that generates a PHP container based on entry definitions.

License

Notifications You must be signed in to change notification settings

moufmouf/yaco

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scrutinizer Code Quality Build Status Coverage Status

YACO - Yet another compiler

YACO (Yet Another COmpiler) is a PHP tool that generates a PHP container based on entry definitions. It is fully compatible with entry definitions from definition-interop.

Installation

You can install this package through Composer:

{
    "require": {
        "thecodingmachine/yaco": "~0.3.0"
    }
}

The packages adheres to the SemVer specification, and there will be full backward compatibility between minor versions.

Usage

This package contains a Compiler class. The goal of this class is to take a number of "entry definitions" (as defined in definition-interop) and to transform those into a PHP class that implements the ContainerInterface

use TheCodingMachine\Yaco\Compiler;

$compiler = new Compiler();

// ...

foreach ($definitions as $definition) {
    /* @var $definition Interop\Container\Definition\DefinitionInterface */
    $compiler->addDefinition($definition);
}

// Let's dump the code of the My\Container class.
file_put_contents("Container.php", $compiler->compile("My\\Container"));

You can also directly register a definition provider using the register method:

use TheCodingMachine\Yaco\Compiler;

$compiler = new Compiler();

// ...

$compiler->register($definitionProvider);

// Let's dump the code of the My\Container class.
file_put_contents("Container.php", $compiler->compile("My\\Container"));

About

YACO (Yet Another COmpiler) is a PHP tool that generates a PHP container based on entry definitions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%