adspray/short-url-bundle
Symfony bundle providing a URL shortener service and Twig filter. Generate short paths like /~ShE from long URLs in controllers or templates, and resolve short codes back to the original URL via routing and a simple shortener service.
~/short pattern).~/short routing; lacks advanced features like custom slugs, analytics, or rate limiting.ShortUrlGenerator service.~/short to Laravel’s routing (e.g., Route::get('short/{slug}', ...)).@shortUrl) or a custom helper.Symfony\Component\HttpKernel). Isolation via Composer’s replace or a facade layer is critical.EventDispatcher, HttpKernel) requires significant abstraction.laravel-short-url) to decouple from Symfony.spatie/url-signing or laravel-short-url for feature parity.~/short paths mandatory, or can we use /r/{slug}?ShortUrlGenerator with a Laravel service binding:
$this->app->singleton(ShortUrlGenerator::class, function ($app) {
return new ShortUrlGenerator($app['router'], $app['path.generator']);
});
~/short to Laravel’s Route::get('short/{slug}', ...) with a controller handling the redirect.{{ short_url() }} with a Blade directive or helper:
// app/Helpers/shortUrl.php
if (!function_exists('shortUrl')) {
function shortUrl($path) { ... }
}
replace or aliases to avoid conflicts:
"replace": {
"symfony/http-kernel": "symfony/http-foundation"
}
phpunit:8.3 or polyfills for deprecated functions.composer.json to target Laravel’s autoloader.HttpKernel → Illuminate\Http).ShortUrlServiceProvider) to register the generator and Blade directive.ShortUrlController to handle ~/short redirects.Cache::remember).~/short could expose sensitive paths if not sanitized.
How can I help you explore Laravel packages today?