LaradminLTE is a Laravel package that seamlessly integrates the powerful AdminLTE v4 dashboard template into Laravel (v11 or higher). Designed for modern web applications, this package provides a fast and flexible way to build responsive, maintainable, and feature-rich admin panels by using a Laravel Blade component to quick access the layout and configuration files to customize it.
Caution
Active Development: LaradminLTE is currently under active development. Features, configuration options, and behavior are subject to change until the first stable release.
- Laravel: 11 or higher
- PHP: 8.2 or higher
Follow these steps to install LaradminLTE in your Laravel application.
Use Composer to add the package to your Laravel project:
composer require dfsmania/laradminlte:^1.0@betaAlternatively, to install the latest development version:
composer require dfsmania/laradminlte:dev-main --prefer-stableLaradminLTE provides an interactive installer to publish the package resources:
php artisan ladmin:installThe installer automatically publishes the required resources:
- Assets: AdminLTE v4 distribution files (
CSS,JS) and images, published topublic/vendor/ladmin. - Configuration: LaradminLTE configuration files, published to
config/ladmin.
During installation, you can also select optional resources:
- Translations: Translation files for customization and additional languages, published to
lang/vendor/ladmin. - Migrations: Database migrations supporting user profile images, published to
database/migrations.
The installer detects previously published files and asks for confirmation before overwriting them, preserving existing customizations by default.
You can install or republish specific resources at any time using the --resource option:
php artisan ladmin:install --resource=translationsTo install multiple resources, repeat the option:
php artisan ladmin:install --resource=translations --resource=migrationsAvailable resource keys are assets, config, translations, and migrations.
When using --resource, only the specified resources are processed, without running the standard installation workflow.
To overwrite existing resources without confirmation, use:
php artisan ladmin:install --forceWarning
The --force option overwrites previously published files and may replace your customizations.
For non-interactive environments, run:
php artisan ladmin:install --no-interactionThis installs the required resources without prompting for optional ones. Existing files are preserved unless --force is specified.
If you installed the optional Migrations resource, run:
php artisan migrateThese migrations add the necessary columns to the users table to support profile images. The installer does not execute database migrations automatically.
Follow these steps to use, configure and test LaradminLTE in your Laravel application:
Set up a route in your routes/web.php file, for example:
Route::get('ladmin_welcome', function () {
return view('laradminlte-welcome');
});Next, create a Blade view to test the package's functionality. The package provides a main blade component that should be used to render the full admin layout.
As example, save the following content in resources/views/laradminlte-welcome.blade.php:
<x-ladmin-panel title="Welcome">
{{-- Setup the content header --}}
<x-slot name="contentHeader">
<div class="row">
<div class="col-12">
<h3 class="fw-bold">
<i class="bi bi-heart-fill text-danger"></i>
Welcome to LaradminLTE!
</h3>
</div>
</div>
</x-slot>
{{-- Setup the content body --}}
<div class="row">
<div class="col-12">
<i class="bi bi-rocket-takeoff-fill fs-5 text-primary"></i>
Now, start building your next administration panel with ease and flexibility.
</div>
</div>
{{-- Push inline scripts if needed --}}
@push('js')
<script>
console.log('LaradminLTE is successfully loaded!');
</script>
@endpush
</x-ladmin-panel>- The
titleattribute of the main component sets the page title, which is automatically appended to your application's name and shown in the browser's title bar. - The
contentHeaderslot is used to define the header section of the content area. - The content body is placed directly within the main component tags (as the default
slotof the component). - The
@push('js')directive allows you to add custom JavaScript code that will be included in the layout. - The
@push('css')directive can also be used to add custom CSS styles if needed.
Important
To use the authentication scaffolding, you need to have the default Laravel's migrations for users already set up in your database. If this is not your case, then you can can install Laravel's default migrations by running: php artisan migrate.
If you want to use the built-in authentication scaffolding, make sure to have it enabled in the config/ladmin/auth.php file, and setup the home_path. The home_path is the place where users will be redirected after login. Then protect your routes using the auth middleware:
// config/ladmin/auth.php:
'enabled' => true,
'home_path' => '/ladmin_welcome',// routes/web.php:
Route::middleware(['auth'])->group(function () {
Route::get('ladmin_welcome', function () {
return view('laradminlte-welcome');
});
// Add other protected routes here...
});After this, all the routes within this group will require authentication to be accessed.
To test the admin panel, you first need to ensure that your Laravel application is running. You can start the development server using the following Artisan command:
php artisan serveThen, just open your browser and navigate to:
http://your-app.test/ladmin_welcomeReplace your-app.test with your local development URL. If authentication is enabled, a login screen will appear. Then, you should see the default admin layout rendered using the package’s out-of-the-box configuration:
Finally, to define your admin panel menu entries, you can edit the config/ladmin/menu.php file. This file allows you to customize the sidebar and navbar menu structure and items according to your application's needs. Remember that each new menu entry that renders a page should provide a blade view that extends the main layout component (<x-ladmin-panel>) to ensure the admin layout is applied correctly.
Explore and modify the package's configuration files to suit your needs:
config/ladmin/main.php: General settings for the admin panel.config/ladmin/menu.php: Define the menu structure.config/ladmin/plugins.php: Manage plugins and extensions.config/ladmin/auth.php: Configure authentication scaffolding.
For detailed usage instructions, advanced configuration options, and customization guides, refer to the Official LaradminLTE Documentation.
Thank you for your interest in contributing to LaradminLTE! We welcome and appreciate all contributions that help improve the project. Please take a moment to review our guidelines on the Contribute page before getting started.
