Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Shorturl Bundle Laravel Package

fabstei/shorturl-bundle

A Symfony bundle for adding short URL support to your applications. It provides services for generating short codes and resolving them back to their original destinations, with simple configuration for dropping into existing Symfony projects.

View on GitHub
Deep Wiki
Context7

Getting Started

Read this first: fabstei/shorturl-bundle is a Symfony2 bundle, not a Laravel package. There is no service provider, no facade, no publishable config, and no Laravel-facing documentation. Treat it as source material to mine, not a dependency to install.

Before writing any code:

  1. composer show fabstei/shorturl-bundle --all — confirm it is still resolvable and check the require block. Expect symfony/symfony: ~2.x and PHP 5.x constraints, which will fail composer require on a modern Laravel app.
  2. Clone the repo and read, in this order:
    • composer.json (autoload: almost certainly PSR-0, namespaced under a Fabstei\ShorturlBundle style vendor dir — check whether it loads under Composer 2 at all)
    • DependencyInjection/*Extension.php and Resources/config/services.xml|yml — this is the real API surface; it tells you which services exist and what they're constructed with
    • the service class the bundle registers — that class is the only thing worth reusing
  3. Look at the underlying shorturl library the bundle wraps (it is a thin DI/controller layer over a separate shorturl implementation). The library, not the bundle, is where shortening logic lives.

First realistic use case for a Laravel dev: you have an Article/Invoice/Share model and you want a stable short link (/s/abc123) for outbound sharing. The bundle's value here is close to zero — you need a short_url column, a route, and a redirect controller. The only thing worth lifting is a hashing/encoding routine, and Laravel already gives you Hashids-style options via community packages.

Minimal Laravel-side shape you'll end up building regardless:

// routes/web.php
Route::get('s/{code}', ShortUrlController::class)->name('short.redirect');

// app/Services/ShortUrl.php
class ShortUrl
{
    public function make(Model $model): string { /* encode + persist */ }
    public function resolve(string $code): ?Model { /* lookup */ }
}

If you genuinely want the bundle's encoder, copy that one class into app/Support/ and rewrite its namespace. Do not pull the bundle in.

Implementation Patterns

Because the package is Symfony2-shaped, "patterns" here means translation patterns — how to move its concepts into Laravel idiom.

Pattern 1 — Extract the service, discard the bundle. The bundle's contribution is (a) a service definition, (b) possibly a controller/Twig helper, (c) config tree. In Laravel:

// app/Providers/ShortUrlServiceProvider.php
$this->app->singleton(ShortUrl::class, function ($app) {
    return new ShortUrl(
        config('shorturl.domain'),
        config('shorturl.length', 7),
    );
});

The constructor args are whatever the bundle's services.xml passes in — read them off the definition rather than guessing.

Pattern 2 — Config translation. Symfony's Configuration.php tree maps 1:1 onto a config/shorturl.php returning a flat array. Copy defaults verbatim; Symfony bundles of that era often have undocumented defaults buried in the Extension class ($container->setParameter('fabstei_shorturl.foo', 'bar')).

Pattern 3 — Persistence. If the bundle ships Doctrine entities/mappings, do not try to reuse them. Write a Laravel migration with the same columns. Doctrine annotation mappings from 2014 frequently use @ORM\... syntax that current doctrine/orm rejects, and the bundle has no Eloquent anything.

Pattern 4 — Delivery. Any Symfony controller in the bundle (redirectAction, createAction) becomes a Laravel invokable controller. Twig helpers become Blade directives or just route('short.redirect', $model->short_code).

Pattern 5 — If you must run it (legacy app port). The only sane integration is an adapter: boot the bundle's class manually, inject it into a Laravel singleton, and keep all Symfony container assumptions (ContainerAware, KernelInterface) satisfied with stubs. This is a day of work for a library that shortens strings; budget accordingly and expect to abandon it.

Integration tip: whichever path you take, wrap it behind your own interface (ShortenerContract) so the 2014 code is one swappable implementation and not threaded through controllers.

Gotchas and Tips

  • Archived and abandoned. Last release 2014-01-20, 12 stars, 0 dependents. No security response, no PHP 7/8 fixes, no Composer 2 guarantees. Assume nothing is maintained.
  • Framework mismatch. No ServiceProvider, no Facade, no config publish, no migrations. Everything Laravel-specific is yours to write.
  • PSR-0 vs PSR-4. Bundles of this vintage use PSR-0 with a vendor/-style directory layout. Under Composer 2's stricter autoloading this often silently fails to autoload — composer dump-autoload -o and inspect vendor/composer/autoload_namespaces.php.
  • PHP version wall. Expect php: >=5.3.3 and code using each(), create_function, or short-array-less syntax. On PHP 8.2+ you'll get deprecations or fatals before you get a short URL.
  • Symfony API drift. ContainerAwareInterface, getContainer(), @Template annotations, sensio/framework-extra-bundle — all removed or changed in Symfony 4+. Any controller in the bundle is dead code on modern stacks.
  • Doctrine entities are traps. Annotation syntax and Doctrine\ORM\Mapping imports from the 2.3–2.4 era will not load on doctrine/orm 2.14+. Don't attempt reuse.
  • Debugging path. If the service won't instantiate, the failure is almost always a missing container parameter — grep the Extension class for setParameter and satisfy every one explicitly.
  • License check before copying. Verify the LICENSE file permits the reuse you're planning (many 2014 bundles are MIT, but confirm rather than assume, especially if you're vendoring code into a commercial app).
  • Extension point that actually matters: none. There is no event dispatcher integration, no strategy interface worth honoring. The only extension point is your own wrapper.
  • The pragmatic recommendation: for a Laravel project in 2025, do not install this. Use hashids/hashids or a short_urls table with a unique index and a /s/{code} redirect route. You will have a working, tested, maintainable feature in under an hour — which is roughly the time you'd spend just reading this bundle's DI config.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core