Skip to content

princejohnsantillan/stubby

Repository files navigation

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

About

A simple way to generate files from stubs.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages