- How do I install andrey-helldar/short-url in a Laravel application?
- Install it with Composer via composer require andrey-helldar/short-url, then publish the package config file and migrations with the vendor:publish command. Run php artisan migrate to create the links table, and set your route prefix or custom domain in the published config. Because the repository is archived, pin the exact version or fork it before adding it to a production codebase.
- Which Laravel and PHP versions does this short URL package support?
- The last release was March 2021, so it targets roughly Laravel 8 with PHP 7.4 to 8.0. Laravel 9 through 12 and PHP 8.2+ introduce breaking changes such as service provider signatures, anonymous migration classes, and stricter typing, so compatibility is not guaranteed. Install it in a scratch app on your actual target version and exercise create, redirect, and delete before committing to the dependency.
- Is andrey-helldar/short-url still maintained?
- No. The repository is archived, the final release was March 2021, and it has around 10 stars, which means no upstream fixes and effectively no production mileage to learn from. Any bug, security issue, or framework incompatibility becomes your responsibility to patch. The MIT license does allow a fork, so the risk is survivable, but plan for it as an unbudgeted ownership transfer rather than a normal dependency.
- How do I change the short code length and character set?
- Code length and the alphabet used for generated short codes are controlled through the package's publishable configuration file. Publish the config with vendor:publish, then adjust the length and character set values before generating links, since changing them later will not rewrite codes already stored. The same config file also holds the route prefix or domain settings for the redirect endpoint.
- How are short links stored and managed?
- The package is Eloquent-backed: each short link is a record pairing a short code with its destination URL, created by a published migration. That means you get model-based management of link records, so you can query, list, and manage links the same way you handle any other Eloquent model. It also keeps link generation logic out of your controllers.
- Can I control whether short links redirect with a 301 or a 302?
- The package handles redirects for resolved short links, but whether the status code is configurable is not documented and needs to be confirmed by reading the source. This matters because 301 responses are cached aggressively by browsers and CDNs and are effectively irreversible, so anything mutable should use 302 or 307. Verify the behavior in the package's controller before relying on it in production.
- How does the package handle short code collisions?
- The documentation does not state whether uniqueness is enforced by a database unique index or by an application-level retry loop, and that distinction changes behavior under concurrency. Read the migration and the generator source to see which approach is used, then load-test simultaneous creation of the same destination. If uniqueness relies only on application checks, add a unique index before going live.
- Is this package safe against open redirect abuse?
- Short-link services are a classic open-redirect vector, and the package does not document a scheme allowlist, host blocklist, or rate limiting. Whether it validates destination schemes or prevents arbitrary user-supplied URLs is a source-level question, not a documentation-level one. Audit the code before exposing link creation to untrusted users, and consider fronting it with your own validation and throttling.
- Can I disable the package routes and use my own controller?
- The package registers its resolver route through its service provider, but whether registration is unconditional and can be switched off is not documented. If you need custom cache headers, abuse checks, or per-tenant routing, confirm in the source that you can disable the routes and front the resolver with your own controller. Route ownership is one of the key things to settle during an evaluation spike.
- Should I use this package or implement short URLs myself?
- The surface area is small: a model, a migration, a code generator, a controller, and a route, which is roughly one to two days to reimplement. Taking a Composer dependency on an archived package means inheriting maintenance, so a reimplementation often wins because it gives you control over redirect status codes, cache headers, revocation, tenancy scoping, and the abuse controls your security team will ask about. Use the package only if the target app is on Laravel 8 or earlier and you accept the ownership cost.