Package Data | |
---|---|
Maintainer Username: | acoustep |
Maintainer Contact: | mitch+componentgenerator@fastmail.co.uk (Mitch Stanley) |
Package Create Date: | 2014-06-25 |
Package Last Update: | 2014-07-24 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-15 03:03:20 |
Package Statistics | |
---|---|
Total Downloads: | 98 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 4 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
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.
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
'Acoustep\ComponentGenerator\ComponentGeneratorServiceProvider',
If you wish to change your settings you can run
php artisan config:publish acoustep/component-generator
Or
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
The base of this code is from Jeffrey Way's Book Laravel Testing Decoded. A great book which has helped me a lot!