Skip to content

Commit 5080a27

Browse files
committed
docs: add v2.1.0 changelog and ControllerResolver usage docs
1 parent 1b1245d commit 5080a27

2 files changed

Lines changed: 56 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,36 @@
22

33
All notable changes to `laravel-unique-urls` will be documented in this file.
44

5+
## v2.1.0 - 2026-02-12
6+
7+
### What's New
8+
9+
#### Pluggable ControllerResolver
10+
11+
Controller resolution is now delegated to a `ControllerResolver` contract, making the package fully extensible without modifying its source.
12+
13+
- **`Contracts\ControllerResolver`** — interface with a single `resolve(string $controller): ?object` method
14+
- **`Resolvers\DefaultControllerResolver`** — ships with the package; resolves FQCNs via `class_exists()` and Livewire component names via `app('livewire')->new()` (only when Livewire is installed)
15+
- Bound as a singleton with `singletonIf`, so apps can override it by binding their own implementation before the package boots
16+
17+
#### Upgrading from v2.0.x
18+
19+
No breaking changes. The default resolver handles both FQCNs and Livewire component names out of the box. The inline `isLivewireComponentName()` check from v2.0.0 has been replaced by the resolver.
20+
21+
To provide custom resolution logic (e.g. Inertia, custom routing):
22+
23+
```php
24+
// AppServiceProvider::register()
25+
$this->app->singleton(
26+
\Vlados\LaravelUniqueUrls\Contracts\ControllerResolver::class,
27+
\App\Services\MyCustomResolver::class,
28+
);
29+
```
30+
31+
---
32+
33+
**Full Changelog**: https://github.com/vlados/laravel-unique-urls/compare/v2.0.1...v2.1.0
34+
535
## v2.0.1 - 2026-02-12
636

737
### Documentation

docs/usage.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,29 @@ public function urlHandler(): array
183183
}
184184
```
185185

186-
The package detects names without backslashes and resolves them via `app('livewire')->new()`.
186+
The default resolver tries `class_exists()` first, then falls back to `app('livewire')->new()` when Livewire is installed.
187+
188+
## Custom Controller Resolution (v2.1+)
189+
190+
Controller resolution is handled by the `ControllerResolver` contract. The default implementation supports both FQCNs and Livewire component names. To customize resolution (e.g. for Inertia or other frameworks), bind your own implementation:
191+
192+
```php
193+
use Vlados\LaravelUniqueUrls\Contracts\ControllerResolver;
194+
195+
// In your AppServiceProvider::register()
196+
$this->app->singleton(ControllerResolver::class, MyCustomResolver::class);
197+
```
198+
199+
Your resolver must implement a single method:
200+
201+
```php
202+
use Vlados\LaravelUniqueUrls\Contracts\ControllerResolver;
203+
204+
class MyCustomResolver implements ControllerResolver
205+
{
206+
public function resolve(string $controller): ?object
207+
{
208+
// Return an object instance or null for 404
209+
}
210+
}
211+
```

0 commit comments

Comments
 (0)