Upgrading from maatwebsite

wikigods/laravel-sidebar 1.0 is the continuation of maatwebsite/laravel-sidebar 3.x. The API is the same; the package name and the namespace change.

1. Swap the package

composer remove maatwebsite/laravel-sidebar
composer require wikigods/laravel-sidebar

If you registered Maatwebsite\Sidebar\SidebarServiceProvider by hand in config/app.php or bootstrap/providers.php, remove it: the new provider is discovered automatically.

2. Replace the namespace

Replace Maatwebsite\Sidebar with Wikigods\Sidebar in your application (sidebar classes, extenders, config/sidebar.php, event listeners):

- use Maatwebsite\Sidebar\Menu;
+ use Wikigods\Sidebar\Menu;

3. Middleware

The package registers the sidebar route middleware alias. If your application registered Maatwebsite\Sidebar\Middleware\ResolveSidebars itself, remove that registration and use the alias:

Route::middleware(['auth', 'sidebar'])->group(function () {
    // ...
});

4. Configuration

Compare your config/sidebar.php with the new one (php artisan vendor:publish --tag=sidebar-config --force overwrites it; back it up first). New keys: sidebar (class, view and key), middleware and permissions. See Configuration.

5. Cache duration

sidebar.cache.duration is now applied in minutes, as documented. Earlier versions passed it to the cache store as seconds, so the default 1440 kept the sidebar for 24 minutes. With 1.0 the same value keeps it for one day; lower it if you relied on the shorter time.

6. Cacheable sidebars

ShouldCache no longer extends PHP's deprecated Serializable interface. If your sidebar uses CacheableTrait, nothing changes. If it implements serialize() / unserialize() itself, implement __serialize(): array and __unserialize(array $data): void instead.

Clear the cache after upgrading, since entries stored by the old package reference the old class names:

php artisan cache:clear

7. Custom code on the console classes

Maatwebsite\Sidebar\Console\* is now Wikigods\Sidebar\Commands\*.