b2r/composition

Easy to generate composition php source

v0.1.0 2017-03-17 03:41 UTC

This package is not auto-updated.

Last update: 2024-11-09 21:01:42 UTC


README

Easy to generate composition php source

Build Status

Usage

use b2r\Component\Composition\Generator;

$gen = new Generator();
$gen->name('PDOWrapper')   # Set composition class|tarit name
    ->namespace('b2r\PDO') # Set namespace
    // ->asTrait()         # Output as trait
    ->target(PDO::class)   # Set composition target class
    ->property('pdo')      # set composition property name
    ->aliases([            # Define aliases
        'lastId' => 'lastInsertId',
        'begin'  => 'beginTransaction',
    ])
    ->excludes(['quote', 'query', 'exec']); # Exclude methods

echo $gen;
// $gen->save('PDOWrapper.php'); // Save to file