2017 © Pedro Peláez
 

library source-generator

PHP source code generator. Can be written using a method chain.

image

jumilla/source-generator

PHP source code generator. Can be written using a method chain.

  • Friday, January 27, 2017
  • by jumilla
  • Repository
  • 1 Watchers
  • 4 Stars
  • 2,272 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 1 % Grown

The README.md

PHP Source Generator

Build Status Quality Score Code Coverage Latest Stable Version Total Downloads Software License, (*1)

日本語ドキュメント - Japanese, (*2)

<?php

use Jumilla\Generators\FileGenerator;

$generator = FileGenerator::make('outdir-path', 'stubdir-path');

# copy
$generator->sourceFile('Controller.php');

# generate in directory
$name = 'notification';
$generator->directory('Services', function ($generator) use ($name) {
    $generator->file(ucfirst($name).'Service.php')->template('Service.php');
});

API

blank file

$generator->file('Class1.php')->blank();

source file from string

$generator->file('Class1.php')->text('## read');

source file from stub

$generator->sourceFile('Class1.php');

source file from string (with arguments)

$generator->file('Class2.php')->text('<?php class {$class_name} {}', [
    'class_name' => 'Class2',
]);

source file from stub (with arguments)

$generator->templateFile('Class2.php');

json file

$generator->json('Class2.php')->json([
    'foo' => 'FOO',
    'bar' => 'BaR',
]);

.gitkeep file

$generator->gitKeepFile();

PHP blank file

$generator->phpBlankFile('functions.php');

PHP config file

$generator->phpConfigFile('config.php', [
    'theme' => 'snow',
    'database' => [
        'default' => 'mysql',
    ],
]);

PHP source file

$generator->phpSourceFile('Controller.php', 'class Controller {}', 'App\Http\Controllers');

get directory walker

$sub = $generator->directory('app/Views');
$sub->sourceFile('layout.twig');
// ...

directory walk in Closure

$generator->directory('app/Views', function ($generator) {
    $generator->sourceFile('layout.twig');
    // ...
});

sources in directory

$generator->sourceDirectory(app/Models');

templates in directory

$generator->templateDirectory('app/Controllers', [
    ''
]);

keep directory (use .gitkeep)

$generator->keepDirectory('app/Services');

Author

古川 文生 / Fumio Furukawa (fumio@jumilla.me), (*3)

Licnese

MIT, (*4)

The Versions

27/01 2017

dev-master

9999999-dev http://jumilla.me

PHP source code generator. Can be written using a method chain.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fumio Furukawa

php code generator source

27/01 2017

1.1.2

1.1.2.0 http://jumilla.me

PHP source code generator. Can be written using a method chain.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fumio Furukawa

php code generator source

06/12 2016

v1.1.1

1.1.1.0 http://jumilla.me

PHP source code generator. Can be written using a method chain.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fumio Furukawa

php code generator source

14/01 2016

1.1

1.1.0.0 http://jumilla.me

PHP source code generator. Can be written using a method chain.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fumio Furukawa

php code generator source

15/10 2015

v1.0.2

1.0.2.0 http://jumilla.me

PHP source code generator. Can be written using a method chain.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fumio Furukawa

php code generator source

14/10 2015

v1.0.1

1.0.1.0 http://jumilla.me

PHP source code generator. Can be written using a method chain.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fumio Furukawa

php code generator source

14/10 2015

v1.0

1.0.0.0 http://jumilla.me

PHP source code generator. Can be written using a method chain.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fumio Furukawa

php code generator source