LaraBit scaffolds Blade views from starter templates (pages, layouts, components, full HTML documents) that you can publish, edit, and extend with your own. Every new view starts with the boilerplate your project actually uses.
php artisan larabit:view layouts.app --type layout
php artisan larabit:view pages.home pages.about pages.contact --extends layouts.app
php artisan larabit:view components.alert --type componentLaravel 10+ also ships a plain
php artisan make:viewthat creates an empty file. LaraBit uses its ownlarabit:viewcommand, so it never replaces the built-in one.
- Requirements
- Installation
- Usage
- Template types
- Custom templates
- Command reference
- Upgrading from 1.x
| LaraBit | Laravel | PHP |
|---|---|---|
| 2.x | 12, 13 | 8.2+ (Laravel 13 needs 8.3+) |
| 1.x | 8, 9 | 7.3+ |
1.x registers make:view, which overrides Laravel's own make:view on Laravel 10 and later. Upgrade to 2.x on current Laravel.
composer require furious-developer/lara-bit --devThe service provider is registered automatically.
php artisan larabit:view indexThis creates resources/views/index.blade.php and prints its path. Run the command without a name and LaraBit asks for one.
Use the same dot notation as view(). Missing folders are created.
php artisan larabit:view admin.users.index
# resources/views/admin/users/index.blade.phpphp artisan larabit:view pages.home pages.about pages.contactEach view is created independently. If one already exists, the others are still created and the command exits with a failure code.
php artisan larabit:view pages.user-profile --extends layouts.admin --section main@extends('layouts.admin')
@section('title', 'User Profile')
@section('main')
<!-- Page Blade Template Created Using: LaraBit -->
@endsection--extends switches the default type to page. --section defaults to content.
LaraBit never overwrites a file unless you pass --force (or -f).
| Type | Creates |
|---|---|
basic (default) |
A minimal HTML5 document |
advance |
An HTML5 document with SEO, Open Graph, favicon, stylesheet and script placeholders |
layout |
A layout with @yield for the title and main section, @stack('styles') / @stack('scripts'), a CSRF meta tag and the app locale |
page |
A child view with @extends, a title section and a content section |
component |
An anonymous component with @props and {{ $slot }}. Create it under components. to use it as <x-...> |
Pick one with --type (or -t). List every available type, including your own, with:
php artisan larabit:typesPublish the bundled templates to resources/views/vendor/larabit and edit them:
php artisan vendor:publish --tag=larabit-viewsA published file with the same name as a bundled type replaces it. Any other Blade file in that folder becomes a new type:
# resources/views/vendor/larabit/livewire-page.blade.php
php artisan larabit:view pages.dashboard --type livewire-pageTemplates are rendered through Blade when the view is created, with these variables:
| Variable | Example (admin.user-profile) |
|---|---|
$view |
admin.user-profile |
$name |
user-profile |
$title |
User Profile |
$extends |
--extends value, default layouts.app |
$section |
--section value, default content |
Because the template itself is rendered, write @@ before a directive and @{{ }} for echoes that should stay in the generated view:
@@extends('{{ $extends }}')
<h1>@{{ $user->name }}</h1>php artisan larabit:view <name>... [options]
-t, --type=TYPE Template type (default: basic, or page with --extends)
--extends=LAYOUT Layout the page extends (default: layouts.app)
--section=NAME Section used by the page and layout templates (default: content)
-f, --force Overwrite existing views
php artisan larabit:types List available template types
- The command is now
larabit:view(previouslymake:view). - It exits with a failure code when a view exists, the template type is unknown, or a name is invalid.
- The bundled templates now use the generated
$titleinstead of "Your Title". - Templates you published with 1.x keep working unchanged.
composer require furious-developer/lara-bit:^2.0 --devSee CHANGELOG.md for details.
Contributions are welcome. See CONTRIBUTING.md and the Code of Conduct. Report security issues privately as described in SECURITY.md.
LaraBit is open-source software licensed under the MIT license.
