Skip to content

Commit 6591f6b

Browse files
committed
docs: Add Livewire 2.x compatibility notice
- Updated CHANGELOG.md with v0.1.2 changes - Added Livewire compatibility section to README - Clarified which features work without Livewire 3.x - Added FAQ section
1 parent d3b7f08 commit 6591f6b

File tree

4 files changed

+143
-8
lines changed

4 files changed

+143
-8
lines changed

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,29 @@
22

33
All notable changes to `aliaser` will be documented in this file.
44

5-
## [Released]
5+
## [0.1.2] - 2025-12-19
6+
7+
### Added
8+
9+
- Automatic Livewire version detection
10+
- Support for projects without Livewire installed
11+
12+
### Changed
13+
14+
- **Breaking**: Livewire 2.x is temporarily not supported
15+
- Livewire synthesizers now only register for Livewire 3.x or High
16+
- Improved service provider registration logic
17+
18+
### Fixed
19+
20+
- Prevented errors when Livewire 2.x is installed
21+
- Package no longer crashes in projects without Livewire
22+
23+
## [0.1.1] - 2025-12-18
24+
25+
### Fixed
26+
27+
- Minor bug fixes and improvements
628

729
## [0.1.0] - 2025-12-17
830

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
[![License](https://img.shields.io/packagist/l/sindyko/aliaser.svg?style=flat-square)](https://packagist.org/packages/sindyko/aliaser)
55
[![Tests](https://github.com/sindyko/aliaser/actions/workflows/tests.yml/badge.svg)](https://github.com/sindyko/aliaser/actions/workflows/tests.yml)
66

7+
## Requirements
8+
9+
- PHP ^8.1|^8.2|^8.3
10+
- Laravel ^10.0|^11.0|^12.0
11+
- Livewire ^3.0 (optional, for Livewire integration)
12+
713
# Aliaser 🎭
814

915
Elegant alias management for Laravel Eloquent models, Livewire forms, DTOs, collections, and enums. Replace long class
@@ -20,6 +26,24 @@ names with short, memorable aliases throughout your application and Livewire sna
2026
- 🔒 **Security** - obfuscated class paths in frontend
2127
- 🧪 **Fully tested** - comprehensive test coverage
2228

29+
## Features
30+
31+
### Core Features (work everywhere)
32+
33+
- 🎯 **Entity Facade** - Access models by alias: `Entity::user(1)` instead of `User::find(1)`
34+
- 🗺️ **Morph Map Integration** - Automatically sync aliases with Eloquent morph map
35+
- 📦 **Multiple Registries** - Separate registries for Models, Forms, DTOs, Collections, and Enums
36+
- 🛠️ **Artisan Commands** - `aliaser:install`, `aliaser:list`, `aliaser:help`
37+
- 🔧 **Helper Functions** - Convenient `modelsMap()`, `formsMap()`, etc.
38+
39+
### Livewire 3.x Features
40+
41+
- 🚀 **Snapshot Optimization** - Up to 50% smaller Livewire snapshots
42+
- 🔒 **Hide Internal Structure** - Short aliases instead of full class names in frontend
43+
-**Custom Synthesizers** - Automatic serialization for Models, Collections, Forms, Enums, and DTOs
44+
45+
> **Note**: Livewire features require Livewire 3.x. See [Livewire Compatibility](#livewire-compatibility) for details.
46+
2347
## 📦 Installation
2448

2549
```bash
@@ -787,5 +811,57 @@ The MIT License (MIT). Please see [License File](LICENSE.md) for more informatio
787811

788812
***
789813

814+
### Livewire Compatibility
815+
816+
**Current Status:**
817+
818+
-**Livewire 3.x** - Fully supported with all features
819+
- ⚠️ **Livewire 2.x** - Not currently supported (coming soon)
820+
-**No Livewire** - Core features work without Livewire
821+
822+
> **Note**: Livewire 2.x support is planned for a future release. Currently, if you have Livewire 2.x installed,
823+
> Livewire-specific features (snapshot optimization) will be automatically disabled, but all other features will work
824+
> normally.
825+
826+
#### What works without Livewire 3?
827+
828+
Even without Livewire 3.x (or without Livewire at all), you can use:
829+
830+
-**Entity facade**: `Entity::user()->where('active', true)->get()`
831+
-**Model morph map integration**: Short aliases in database polymorphic relations
832+
-**All registries**: Models, Forms, Objects, Collections, Enums
833+
-**Artisan commands**: `aliaser:list`, `aliaser:help`, etc.
834+
835+
Only **Livewire snapshot optimization** requires Livewire 3.x.
836+
837+
#### Upgrading to Livewire 3
838+
839+
If you're using Livewire 2.x and want full Aliaser integration:
840+
841+
***
842+
843+
## FAQ
844+
845+
### Does Aliaser work without Livewire?
846+
847+
Yes! Core features like Entity facade, morph map integration, and registries work perfectly without Livewire. Only
848+
snapshot optimization requires Livewire 3.x.
849+
850+
### I have Livewire 2.x installed. Will Aliaser work?
851+
852+
Yes, but with limited functionality. Aliaser will automatically detect Livewire 2.x and disable Livewire-specific
853+
features. The Entity facade, registries, and morph map integration will work normally. Livewire 2.x support is planned
854+
for future releases.
855+
856+
### Why doesn't Aliaser support Livewire 2.x yet?
857+
858+
Livewire 3 introduced a new synthesizer architecture that Aliaser uses for snapshot optimization. Livewire 2 has a
859+
different internal structure. We're working on backward compatibility and plan to support Livewire 2.x in an upcoming
860+
release.
861+
862+
### How do I check which version of Livewire I have?
863+
864+
***
865+
790866
Made with ❤️ for the Laravel community
791867

src/Providers/AliaserServiceProvider.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function register(): void
2929
$this->app->alias('entity.manager', EntityManager::class);
3030
$this->app->alias('entity.registry', ModelRegistry::class);
3131

32-
if (class_exists(\Livewire\Livewire::class)) {
32+
if ($this->isLivewire3Available()) {
3333
$this->app->register(LivewireSynthServiceProvider::class);
3434
}
3535
}
@@ -61,4 +61,25 @@ protected function syncMorphMap(): void
6161
Relation::enforceMorphMap($map);
6262
}
6363
}
64+
65+
protected function isLivewire3Available(): bool
66+
{
67+
if (! class_exists(\Livewire\Livewire::class)) {
68+
return false;
69+
}
70+
71+
if (class_exists(\Composer\InstalledVersions::class)) {
72+
try {
73+
$version = \Composer\InstalledVersions::getVersion('livewire/livewire');
74+
75+
if ($version && version_compare($version, '3.0.0', '>=')) {
76+
return true;
77+
}
78+
} catch (\Exception $e) {
79+
// Fallback
80+
}
81+
}
82+
83+
return class_exists(\Livewire\Mechanisms\HandleComponents\Synthesizers\Synth::class);
84+
}
6485
}

src/Providers/LivewireSynthServiceProvider.php

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sindyko\Aliaser\Providers;
46

57
use Illuminate\Support\ServiceProvider;
@@ -23,24 +25,38 @@ class LivewireSynthServiceProvider extends ServiceProvider
2325

2426
public function boot(): void
2527
{
26-
if (! $this->isLivewireAvailable()) {
28+
if (! $this->isLivewireV3OrHigher()) {
2729
return;
2830
}
2931

3032
$this->registerSynthesizers();
3133
}
3234

33-
protected function isLivewireAvailable(): bool
35+
protected function isLivewireV3OrHigher(): bool
3436
{
35-
return class_exists(\Livewire\Livewire::class);
37+
if (! class_exists(\Livewire\Livewire::class)) {
38+
return false;
39+
}
40+
41+
if (class_exists(\Composer\InstalledVersions::class)) {
42+
try {
43+
$version = \Composer\InstalledVersions::getVersion('livewire/livewire');
44+
45+
if ($version && version_compare($version, '3.0.0', '>=')) {
46+
return true;
47+
}
48+
} catch (\Exception $e) {
49+
// Fallback
50+
}
51+
}
52+
53+
return class_exists(\Livewire\Mechanisms\HandleComponents\Synthesizers\Synth::class);
3654
}
3755

3856
protected function registerSynthesizers(): void
3957
{
4058
foreach ($this->synthesizers as $synthesizer) {
41-
if (class_exists($synthesizer)) {
42-
\Livewire\Livewire::propertySynthesizer($synthesizer);
43-
}
59+
\Livewire\Livewire::propertySynthesizer($synthesizer);
4460
}
4561
}
4662
}

0 commit comments

Comments
 (0)