Simple way to create files from stubs.

1.1.2 2022-06-06 01:06 UTC

This package is auto-updated.

Last update: 2024-06-16 15:25:11 UTC


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