This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Laravel 4 package for generating HTML components from Web Frameworks such as Twitter Bootstrap via command line.

v0.3.0 2014-07-19 19:54 UTC

This package is not auto-updated.

Last update: 2021-06-07 10:01:26 UTC


Build Status

Inspired by Bourbon Refill's Rails generators, Component Generator is a Laravel 4 package to quickly generate HTML components from Web Frameworks such as Twitter Bootstrap via command line.

Getting Started

By default running the following command will create a new file in views/components/navbar.blade.php with the Twitter Bootstrap navigation bar.

php artisan component:generate navbar

If you want to change the directory the file is created in your can use the --path option

php artisan component:generate navbar --path="app/views"

To append a component to an already existing file use component:append

php artisan component:append navbar layouts.default

The first argument is the component. The second argument is the template to append to - located inside of app/views.


"acoustep/component-generator": "dev-master"

Add the service provider


If you wish to change your settings you can run

php artisan config:publish acoustep/component-generator


php artisan component:setup


'framework' => 'bootstrap3'

This is the name of the directory to copy views from. Alternatives include foundation5 and pure1.

'directory' => 'components'

Where the components are copied to. This will be in the app/views directory. To copy them to the root of views change it to an empty string.

'prefix' => ''

Put a prefix on filenames. For instance, if you come from a Rails background and prefer to use an underscore to prefix partials then you can set that here.

'postfix' => '.blade.php',
'syntax' => 'blade',

Don't use blade? You can change to normal PHP templates with the following settings

'postfix' => '.php',
'syntax' => 'php',


To list all the components via command line use

php artisan component:list

To view a specific framework's components pass in the framework option

php artisan component:list --framework=bootstrap3

Twitter Bootstrap

Zurb Foundation

  • accordion
  • alerts
  • breadcrumb
  • button-dropdown
  • button-group
  • button-split
  • equalizer
  • form
  • iconbar
  • joyride
  • layout
  • modal
  • offcanvas
  • orbit
  • pagination
  • panel
  • pricing-table
  • progress
  • range-slider
  • table
  • tabs-vertical
  • tabs
  • thumbnails
  • tooltip
  • topbar
  • video


  • form-aligned
  • form-inline
  • form-multi
  • form
  • layout
  • menu
  • pagination
  • table

To do

  • Ability to publish views for customising before generation.


The base of this code is from Jeffrey Way's Book Laravel Testing Decoded. A great book which has helped me a lot!