SmarchSoftware / motherbox by landjea

A Laravel 5 package generator
21
6
1
Package Data
Maintainer Username: landjea
Maintainer Contact: packages@smarchsoft.com (Smarch Software)
Package Create Date: 2016-03-30
Package Last Update: 2016-12-21
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-04-19 15:06:55
Package Statistics
Total Downloads: 21
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 6
Total Watchers: 1
Total Forks: 2
Total Open Issues: 1

This is probably only of use to me, but I have need of it in multiple apps so I packaged it up in case you want it too. :)


Motherbox

A package generator for Laravel 5. I used to use "workbench" all the time in laravel 4 and after not liking the ones I found and getting tired of copying/pasting/manipulating a bunch of files after running a CRUD generator, I decided to make a full package generator that allows me to customize the generated files and fields for the views.

Overview

From a single line on the command prompt, Motherbox will generate an entire packagist.com ready package for laravel. You can use the provided stub files or you can customize the stub files to work the way you want. You can, optionally, create (or not) any of the following files for your package :

  • Composer.json file (with configurable options)
    • Vendor
    • Name
    • Author
    • Email
  • Config
  • Controller
  • Facade
  • License
  • Middleware
  • Migration
    • Migrate (if you just want to make the file but not run it, set "migrate" to "no")
  • Model
    • Table
    • Primary Key
    • Fields
    • Fillable
    • Guarded
  • Policy
  • Requests
  • Routes
  • Seed
  • Test
  • Views (create, show/edit and index)

You can place the info for the config options you don't want to to type out in the motherbox config file. So if you make numerous packages and never need Migration files you can set your config file for migration = 'no' and never make one. If you decide, however, for one package you need a migration you can add the option of --migration=yes and it will create the file regardless. Command line options always supercede config file options.

Installation

This page is intended for installation, please check out the wiki for more information about usage. (In progress)

:black_square_button: Composer

composer require "smarch/motherbox"

:pencil: Service Provider

Motherbox is a Laravel atristan command but the views it generatesuses the HTML Forms package from the "Laravel Collective" for Html & Form rendering so composer will install that as well if you don't already have it installed (you probably do...or should). Once composer has installed the necessary packages for Motherbox to function you need to open your laravel config page for service providers and add Motherbox (and if necessary the Laravel Collective Html provider). To properly function you need to have both service providers referenced : HTML Forms and Motherbox.

config/app.php

   /*
    * Third Party Service Providers
    */
    Collective\Html\HtmlServiceProvider::class, // For Motherbox to function
    Smarch\Motherbox\MotherboxServiceProvider::class, // For Motherbox

:pencil: Facades

Next you will need to add the Forms Facades to your config app file. Motherbox has no facade as it is only an artisan command.

config/app.php

    /*
    * Third Party Service Providers
    */
    'Form'  => Collective\Html\FormFacade::class,	// required for Motherbox Forms
    'HTML'  => Collective\Html\HtmlFacade::class,	// required for Motherbox Forms

:card_index: Publishing Stub and config files

If you wish to use the motherbox config options or customize the stub files for your own needs you will need to publish the files. From your command prompt (wherever you run your artisan commands) enter the following command php artisan vendor:publish --provider=Smarch\Motherbox\MotherboxServiceProvider. This will create the Motherbox config file and puts the stubs files in ROOT\resources\motherbox\stubs.

php artisan vendor:publish --provider=Smarch\Motherbox\MotherboxServiceProvider

:trident: Why "Motherbox"?

I've been a DC geek for over 30 years now and all my packages have a DC Universe name. Motherbox as an entire package generator will make sense to use DC folk. :smile: