A simple way to generate files from stubs.
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
}php stubby generate magic.stub FooBar.phpThe 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$values = ["namespace" => "App", "class" => "FooBar"];
Stubby::stub("magic.stub")->generate("FooBar.php", $values);<?php
namespace App;
use App\Magic;
class FooBar extends Magic
{
// Write down the magic here
}- Proof of Concept
- Publish as a composer package
- Add tests
- Make documentation