Skip to content

Commit 49deb1c

Browse files
author
nejc
committed
first commit
0 parents  commit 49deb1c

File tree

1 file changed

+181
-0
lines changed

1 file changed

+181
-0
lines changed

README.md

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
# LaravelPlus Version Platform Manager
2+
3+
A Laravel package for managing platform versions and showing "what's new" content to users based on their current version.
4+
5+
## Features
6+
7+
- **Version Management**: Track platform versions and user versions
8+
- **What's New Content**: Store and manage feature announcements
9+
- **Smart Notifications**: Show modals to users based on their version
10+
- **Version Comparison**: Compare user versions with platform versions
11+
- **Admin Interface**: Manage versions and content through admin panel
12+
13+
## Installation
14+
15+
1. Install the package via Composer:
16+
17+
```bash
18+
composer require laravelplus/version-platform-manager
19+
```
20+
21+
2. Publish the configuration and migrations:
22+
23+
```bash
24+
php artisan vendor:publish --provider="LaravelPlus\VersionPlatformManager\Providers\VersionPlatformManagerServiceProvider"
25+
```
26+
27+
3. Run the migrations:
28+
29+
```bash
30+
php artisan migrate
31+
```
32+
33+
## Usage
34+
35+
### Basic Usage
36+
37+
The package automatically handles version checking and modal display. Simply include the component in your views:
38+
39+
```php
40+
<x-what-is-new></x-what-is-new>
41+
```
42+
43+
### Managing Platform Versions
44+
45+
Add a new platform version:
46+
47+
```php
48+
use LaravelPlus\VersionPlatformManager\Models\PlatformVersion;
49+
50+
PlatformVersion::create([
51+
'version' => '1.0.0',
52+
'title' => 'Major Update',
53+
'description' => 'New features and improvements',
54+
'is_active' => true,
55+
'released_at' => now(),
56+
]);
57+
```
58+
59+
### Managing What's New Content
60+
61+
Add content for a specific version:
62+
63+
```php
64+
use LaravelPlus\VersionPlatformManager\Models\WhatsNew;
65+
66+
WhatsNew::create([
67+
'platform_version_id' => $version->id,
68+
'title' => 'New Feature',
69+
'content' => 'Description of the new feature',
70+
'type' => 'feature', // feature, improvement, bugfix, security
71+
'is_active' => true,
72+
]);
73+
```
74+
75+
### Checking User Versions
76+
77+
Check if a user needs to see updates:
78+
79+
```php
80+
use LaravelPlus\VersionPlatformManager\Services\VersionService;
81+
82+
$versionService = app(VersionService::class);
83+
$needsUpdate = $versionService->userNeedsUpdate($user);
84+
```
85+
86+
## Configuration
87+
88+
The package configuration file `config/version-platform-manager.php` contains:
89+
90+
- Default user version
91+
- Modal display settings
92+
- Version comparison logic
93+
- Admin panel settings
94+
95+
## Database Structure
96+
97+
### Platform Versions Table
98+
99+
Stores platform version information:
100+
101+
- `version`: Version string (e.g., "1.0.0")
102+
- `title`: Version title
103+
- `description`: Version description
104+
- `is_active`: Whether the version is active
105+
- `released_at`: Release date
106+
107+
### What's New Table
108+
109+
Stores feature announcements:
110+
111+
- `platform_version_id`: Reference to platform version
112+
- `title`: Feature title
113+
- `content`: Feature description
114+
- `type`: Feature type (feature, improvement, bugfix, security)
115+
- `is_active`: Whether the feature is active
116+
117+
### User Versions Table
118+
119+
Tracks user version information:
120+
121+
- `user_id`: User reference
122+
- `version`: User's current version
123+
- `last_seen_version`: Last version the user has seen
124+
- `updated_at`: Last update timestamp
125+
126+
## Components
127+
128+
### What's New Modal
129+
130+
The package provides a Blade component that automatically shows the modal when needed:
131+
132+
```php
133+
<x-what-is-new></x-what-is-new>
134+
```
135+
136+
### Admin Components
137+
138+
Admin components for managing versions and content:
139+
140+
```php
141+
<x-version-platform-manager::admin.versions></x-version-platform-manager::admin.versions>
142+
<x-version-platform-manager::admin.whats-new></x-version-platform-manager::admin.whats-new>
143+
```
144+
145+
## API
146+
147+
### VersionService
148+
149+
Main service for version management:
150+
151+
```php
152+
$versionService = app(VersionService::class);
153+
154+
// Check if user needs update
155+
$needsUpdate = $versionService->userNeedsUpdate($user);
156+
157+
// Get user's current version
158+
$version = $versionService->getUserVersion($user);
159+
160+
// Update user version
161+
$versionService->updateUserVersion($user, '1.0.0');
162+
163+
// Get what's new for user
164+
$whatsNew = $versionService->getWhatsNewForUser($user);
165+
```
166+
167+
## Events
168+
169+
The package fires several events:
170+
171+
- `UserVersionUpdated`: When a user's version is updated
172+
- `PlatformVersionCreated`: When a new platform version is created
173+
- `WhatsNewCreated`: When new content is added
174+
175+
## Contributing
176+
177+
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
178+
179+
## License
180+
181+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

0 commit comments

Comments
 (0)