Skip to content

LaravelPlus/version-platform-manager

Repository files navigation

LaravelPlus Version Platform Manager

A Laravel package for managing platform versions and showing "what's new" content to users based on their current version.

Features

  • Version Management: Track platform versions and user versions
  • What's New Content: Store and manage feature announcements
  • Smart Notifications: Show modals to users based on their version
  • Version Comparison: Compare user versions with platform versions
  • Admin Interface: Manage versions and content through admin panel

Installation

  1. Install the package via Composer:
composer require laravelplus/version-platform-manager
  1. Publish the configuration and migrations:
php artisan vendor:publish --provider="LaravelPlus\VersionPlatformManager\Providers\VersionPlatformManagerServiceProvider"
  1. Run the migrations:
php artisan migrate

Usage

Basic Usage

The package automatically handles version checking and modal display. Simply include the component in your views:

<x-what-is-new></x-what-is-new>

Managing Platform Versions

Add a new platform version:

use LaravelPlus\VersionPlatformManager\Models\PlatformVersion;

PlatformVersion::create([
    'version' => '1.0.0',
    'title' => 'Major Update',
    'description' => 'New features and improvements',
    'is_active' => true,
    'released_at' => now(),
]);

Managing What's New Content

Add content for a specific version:

use LaravelPlus\VersionPlatformManager\Models\WhatsNew;

WhatsNew::create([
    'platform_version_id' => $version->id,
    'title' => 'New Feature',
    'content' => 'Description of the new feature',
    'type' => 'feature', // feature, improvement, bugfix, security
    'is_active' => true,
]);

Checking User Versions

Check if a user needs to see updates:

use LaravelPlus\VersionPlatformManager\Services\VersionService;

$versionService = app(VersionService::class);
$needsUpdate = $versionService->userNeedsUpdate($user);

Configuration

The package configuration file config/version-platform-manager.php contains:

  • Default user version
  • Modal display settings
  • Version comparison logic
  • Admin panel settings

Admin Sidebar (Dynamic Navbar)

The admin sidebar is fully configurable via the navbar_links array in config/version-platform-manager.php.

You can add, remove, or reorder links. Each link supports:

  • label: The text to display
  • route: (optional) The Laravel route name to use
  • url: (optional) A direct URL (internal or external)
  • icon: (optional) SVG icon markup
  • target: (optional) e.g. _blank to open in a new tab

Example:

'navbar_links' => [
    [
        'label' => 'Dashboard',
        'route' => 'version-manager.dashboard',
        'icon' => '<svg ...></svg>',
    ],
    [
        'label' => 'Logs',
        'url' => '/admin/logs',
        'icon' => '<svg ...></svg>',
        'target' => '_blank', // open in new tab
    ],
    // Add more links as needed
],
  • If both route and url are present, route is used.
  • The sidebar will highlight the active link for both route and URL types.
  • You can use any SVG icon markup for the icon field.

Database Structure

Platform Versions Table

Stores platform version information:

  • version: Version string (e.g., "1.0.0")
  • title: Version title
  • description: Version description
  • is_active: Whether the version is active
  • released_at: Release date

What's New Table

Stores feature announcements:

  • platform_version_id: Reference to platform version
  • title: Feature title
  • content: Feature description
  • type: Feature type (feature, improvement, bugfix, security)
  • is_active: Whether the feature is active

User Versions Table

Tracks user version information:

  • user_id: User reference
  • version: User's current version
  • last_seen_version: Last version the user has seen
  • updated_at: Last update timestamp

Components

What's New Modal

The package provides a Blade component that automatically shows the modal when needed:

<x-what-is-new></x-what-is-new>

Admin Components

Admin components for managing versions and content:

<x-version-platform-manager::admin.versions></x-version-platform-manager::admin.versions>
<x-version-platform-manager::admin.whats-new></x-version-platform-manager::admin.whats-new>

API

VersionService

Main service for version management:

$versionService = app(VersionService::class);

// Check if user needs update
$needsUpdate = $versionService->userNeedsUpdate($user);

// Get user's current version
$version = $versionService->getUserVersion($user);

// Update user version
$versionService->updateUserVersion($user, '1.0.0');

// Get what's new for user
$whatsNew = $versionService->getWhatsNewForUser($user);

Events

The package fires several events:

  • UserVersionUpdated: When a user's version is updated
  • PlatformVersionCreated: When a new platform version is created
  • WhatsNewCreated: When new content is added

Contributing

Please see CONTRIBUTING.md for details.

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published