Laravel URL v1.0.0
First public release of atldays/laravel-url.
Laravel URL is a Laravel-friendly package for working with URLs through typed value objects, sanitizer pipelines, validation rules, request macros, and optional spatie/laravel-data integration.
Built on top of spatie/url, this release provides a clean foundation for handling regular web URLs, browser-specific URLs, and messy real-world input inside Laravel applications.
Highlights
Atldays\Url\Url value object built on top of spatie/url
- browser-specific scheme support:
chrome-extension, moz-extension, chrome, opera, edge
UrlFactory and Url facade for creating URLs consistently
- configurable sanitizer profiles for different input sources
- built-in sanitizers for:
- header value cleanup
- control character cleanup
- UTF-8 normalization
- Laravel validation rules:
Atldays\Url\Rules\Url
Atldays\Url\Rules\BrowserUrl
- request macros:
getUrlFromHeader
getOriginUrl
getRefererUrl
getFullUrl
- optional
spatie/laravel-data integration:
UrlCast
ToUrlCast
UrlTransformer
- package translations for validation messages
- Laravel config publishing and translations publishing support
Included In This Release
Core URL layer
- custom URL class with browser scheme support
- IP-host detection
- base URL extraction with port support
- package contracts for typed integrations
Sanitization pipeline
- configurable profile-based sanitizer registry
- default profile for general input
- header profile for
Origin and Referer-style values
- clean separation between URL creation and input preprocessing
Laravel integration
- service provider with package registration
- facade alias for short usage
- request macros for typed URL extraction
- translation namespace support
Validation
- standard URL validation rule
- browser URL validation rule
- nullable-friendly Laravel behavior
Data objects
- casts for strict URL casting and URL coercion
- transformer for serializing URL objects back to strings
Developer experience
- PHPUnit test suite
- Laravel Pint formatting
- publishable config
- publishable translations
- production-ready README and contribution guide
Installation
composer require atldays/laravel-url
Optional:
composer require spatie/laravel-data
Publishing
Publish config:
php artisan vendor:publish --tag="url-config"
Publish translations:
php artisan vendor:publish --tag="url-translations"
Notes
- supported PHP version:
^8.2
- supported Laravel versions:
^11.0|^12.0|^13.0
- package name:
atldays/laravel-url
Thanks
Special thanks to Spatie URL for providing the parsing foundation that this package builds on.