princejohnsantillan / stubby
Simple way to create files from stubs.
1.1.2
2022-06-06 01:06 UTC
Requires
- php: ^8.1
Requires (Dev)
- laravel-zero/framework: ^9.1
- mockery/mockery: ^1.4.4
- nunomaduro/termwind: ^1.10
- pestphp/pest: ^1.21.1
README
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
- Publish as a composer package
- Add tests
- Make documentation