›
byrcsc/laravel-whitelabel · 1.x
Install the package and choose config or database storage for brand definitions.
Install Laravel Whitelabel in an application that serves more than one brand. The package requires PHP 8.3 or later and Laravel 12 or 13.
composer require byrcsc/laravel-whitelabelLaravel package discovery registers the service provider. You do not need to
add it to bootstrap/providers.php.
php artisan whitelabel:installThe command publishes config/whitelabel.php. In an interactive terminal it
asks whether to publish the database migration. The default answer keeps brands
in configuration.
Use --force to replace an existing published config file:
php artisan whitelabel:install --forceReview local changes before keeping an overwritten config file.
Keep the default driver when brands change with application code:
'driver' => 'config',For runtime writes, publish the migration without an interactive prompt:
php artisan whitelabel:install --database
php artisan migrateThen change the driver:
'driver' => 'database',The migration reads whitelabel.database.connection and
whitelabel.database.table when it runs. Set those values before migration if
the brands table belongs on another connection or needs another name.
The config driver requires the identifier in whitelabel.default to exist when
at least one brand is configured:
'default' => 'default',
'brands' => [
'default' => [
'name' => 'Example',
'logo' => 'brands/default/logo.svg',
'colors' => ['primary' => '#111827'],
],
],When the config driver's default brand omits name, the package uses
app.name. The database driver does not apply that package default, so store a
name if the database-backed default brand needs one.
The service provider exposes three publish tags:
| Tag | Destination |
|---|---|
whitelabel-config | config/whitelabel.php |
whitelabel-migrations | database/migrations/*_create_whitelabel_brands_table.php |
whitelabel-views | resources/views/vendor/whitelabel |
Publish views only when you need to change the component markup:
php artisan vendor:publish --tag=whitelabel-viewsPublished views override the package views and become application code that you must maintain.