kematjaya/url-bundle
A lightweight PHP package for generating, parsing, validating, and managing URLs. It offers a simple API to centralize link handling, reduce repetitive string manipulation, and integrate cleanly into existing PHP or Laravel projects.
This is a Symfony bundle, not a Laravel package — there is no ServiceProvider, no config/url-bundle.php, and no php artisan integration. If you are coming from Laravel, treat this as "a third-party Symfony library you may need to bridge into a Laravel app," and budget accordingly.
Minimal steps:
src/DependencyInjection/*Extension.php, src/Resources/config/services.yaml, and the src/Entity/ directory. Check what the bundle actually claims: the name suggests URL storage/management (possibly shortening or route-to-URL mapping), but confirm against the entity fields.composer.json for the symfony/* version constraints. A low-traffic bundle is often pinned to Symfony 4/5 and will not install on a modern Symfony 7 app without a conflict.composer require kematjaya/url-bundle
config/bundles.php:
Kematjaya\URLBundle\URLBundle::class => ['all' => true],
php artisan-equivalent is bin/console doctrine:migrations:diff then doctrine:migrations:migrate), inject the bundle's service or repository into a controller, and persist one URL record. That single round-trip validates the DI wiring, the Doctrine mapping, and the table name in one shot.If the bundle's service wiring fails at container compile time on a modern Symfony, stop — that is your signal the package is not viable for your stack without forking.
Entity-first usage. Most small kematjaya bundles follow a Doctrine-entity-plus-repository pattern. The intended workflow is:
EntityManager::flush().*Repository class rather than writing raw DQL, so you stay on the supported path.Service injection. Register your consumer as a normal Symfony service and let autowiring pull the bundle's manager in:
public function __construct(private UrlManager $urlManager) {}
If autowiring fails, the bundle probably did not alias its interface — declare the binding explicitly in config/services.yaml.
Laravel bridging pattern. If you must use it inside Laravel:
Kernel::registerBundles(), which Laravel has no equivalent for.doctrine/dbal, or run a Symfony micro-kernel and call it out-of-process. Both are more work than reimplementing the URL model directly (it is usually a handful of columns).Schema ownership. Prefer generating your own migration from the bundle's entity mapping rather than relying on any bundled migrations. This lets you control indexes (put a unique index on the URL/route column) and avoids the bundle shipping a migration that targets the wrong table prefix.
Read paths. For anything hot (redirect lookups), wrap the repository in your own caching decorator. A 3-star bundle will not ship a cache layer, and URL-to-entity lookups are exactly the kind of query you want in Redis.
composer.json proves otherwise. Fork it into your VCS (or vendor it under packages/ with a path repository) before shipping to production."kematjaya/url-bundle": "1.0.3"), not ^1.0. A single-tag repo can be force-pushed or re-tagged, and Composer will happily resolve to a broken commit.MappingException or "The table with name ... already exists," inspect the entity's #[ORM\Table] / @ORM\Table attributes and override rather than migrate blindly.bin/console cache:clear and read the full InvalidArgumentException/ServiceNotFoundException — it names the missing service ID, which usually tells you which alias to add in services.yaml.KernelTestCase) before you build on it. If there is no tests/ directory in the repo, that is a real risk, not a nitpick.DependencyInjection/Configuration.php for what is actually configurable before assuming there is a knob.hashids/hashids for short IDs, cocur/slugify for slugs, or a ~50-line custom Doctrine entity — each is better supported than this bundle and removes the Symfony-in-Laravel friction entirely.Bottom line: usable only in a Symfony app that matches its version constraints, and only after forking and smoke-testing it. For a Laravel codebase, the pragmatic call is to reimplement the (likely small) URL model yourself and skip the bundle.
How can I help you explore Laravel packages today?