jeroen-g/laravel-builder

This package is abandoned and no longer maintained. No replacement package was suggested.

Build rapidly classes based on stubs.

v0.2 2016-03-17 11:47 UTC

This package is auto-updated.

Last update: 2022-02-01 12:56:01 UTC


README

Latest Version on Packagist Build Status

Build your Laravel application from the command line or, at some point in the future, through an interface.

Install

Via Composer

$ composer require jeroen-g/laravel-builder

In config/app.php add

        JeroenG\LaravelBuilder\LaravelBuilderServiceProvider::class,

Usage

In your code

An instance of the builder class is binded in the service provider. You can use the Builder in your code in one of the following ways. Stubs are searched in the stubs/ directory, so run the command first (see next section).

  1. With variables
$builder->stub = 'model';  // model.stub found in stubs/
$builder->namespace = 'App\\Models';
$builder->class = 'Test';
$builder->path = 'app/Models/Test';  // Relative to base_path().
$builder->run()->save();  // Creates and then saves the file.
$builder->reset();  // Resets the variables for a completely new build process.
  1. With an array
$builder->fromArray([
    'stub' => 'model',
    'namespace' => 'App\\Models',
    'class' => 'Test',
    'path' => 'app/Models/Test'
]);  // No need to run() or save() or reset().
  1. With Json
$json = json_encode([  // You could for example have .json files for this.
    'stub' => 'model',
    'namespace' => 'App\\Models',
    'class' => 'Test',
    'path' => 'app/Models/Test'
]);
$builder->fromJson($json);  // No need to run() or save() or reset().

The command line

You can also use the following commands.

  1. Publish all the included stubs to the stubs/ directory.
$ php artisan build:stubs

You can add your own stubs to this directory as well. It currently ships with very little stubs, if you have made your own, feel free to add them to the package with a Pull Request.

  1. Building a file
$ php artisan build model App\\Models Test app/Models/Test

Through the web interface

After installing the package and publishing the stubs, the web interface is accessible by visiting /builder. You can create single files or a resource (controller, model, form request, policy, migration, views).

Change log

Please see changelog for more information what has changed recently.

Testing

$ composer test

Contributing

Please see contributing for details.

Credits

License

The EUPL License. Please see the License File for more information.