STUBBY
A simple way to generate files from stubs.
Usage
For example we have a stub file that looks like this:
<?php
namespace {{ namespace }};
use App\Magic;
class {{ class }} extends Magic
{
// Write down the magic here
}
Via CLI
php stubby generate magic.stub FooBar.php
The commnd-line will ask you to give a value for every token found in the stub file.
Provide a value for {{ namespace }}:
> App
Provide a value for {{ class }}:
> FooBar
Successfully generated Foobar.php
Via Stubby class
$values = ["namespace" => "App", "class" => "FooBar"];
Stubby::stub("magic.stub")->generate("FooBar.php", $values);
Expected Output
<?php
namespace App;
use App\Magic;
class FooBar extends Magic
{
// Write down the magic here
}
Roadmap
- Proof of Concept
- Add tests
- Publish as a composer package
- Make documentation