rz/media-bundle
rz/media-bundle is a Symfony bundle for integrating media management into your application, providing services and configuration to handle uploads, storage, and media entities. It aims to simplify wiring media handling into Symfony projects, though it is a low-visibility package with minimal adoptio...
rz/media-bundle is a thin Symfony 2-era extension for SonataMediaBundle, not a standalone media library. Treat it as a plugin you install alongside Sonata, not instead of it. Because the repo is archived, zero-star, and has no dependents, start by reading the source before running composer require — assume you may need to vendor/copy it rather than rely on it as a maintained dependency.
Minimal steps:
composer.json and check the symfony/* and sonata-project/media-bundle constraints. This bundle targets Symfony 2.x; it will not resolve cleanly against Symfony 3.4+/4+ or modern Sonata (4.x/5.x) without patching. Pin your project to the matching Sonata version or expect conflicts.dev-master from the archived repo), then register new RZ\MediaBundle\RZMediaBundle() in AppKernel.php. Registration order matters: it must come after SonataMediaBundle, SonataAdminBundle, and SonataCoreBundle, since it extends their services and templates.sonata_media config (db driver, default context, filesystem/ Imagine adapters) is a prerequisite. This bundle's config tree usually adds contexts, providers, or template overrides on top — it does not replace the base setup.DependencyInjection/Configuration.php — the real contract; tells you what config keys it expects.DependencyInjection/*Extension.php and Resources/config/*.xml — which Sonata service IDs it decorates/overrides.Provider/ classes — likely BaseProvider subclasses registering new media types.Resources/views/ — template overrides applied to Sonata admin/media rendering.Treat it as a Sonata extension layer. The day-to-day workflow is: keep SonataMediaBundle as the media engine, and let this bundle contribute providers, contexts, admin tweaks, or templates. Don't route core media CRUD through it independently.
config.yml under sonata_media.contexts and let this bundle's config add its own providers/formats. Contexts map to upload dirs and Imagine formats; keep them small and explicit (e.g., default, news, avatar) and align formats with LiipImagine/Imagine filter sets.sonata_media.providers.<name> and reference it in a context. To add behavior without forking, subclass its provider and override getProviderMetadata()/buildMedia/postPersist, then swap the service ID in your app config.app/Resources/RZMediaBundle/views/...) over editing vendor files. If it overrides Sonata templates, check Resources/views/ for the exact path and Twig block names — override at the most specific bundle level so Sonata upgrades don't silently break you.sonata.media.provider.* or filesystem services with a compiler pass rather than patching this bundle. This keeps the archived code untouched.sonata_admin. Configure form fields for media selection using Sonata's sonata_type_model_list / media type, ensuring the bundle's provider is selectable.container:debug output against expected service IDs after an upgrade.AppKernel.container:debug / debug:config rather than trusting that YAML "took."web/uploads/media (or configured adapter). Ensure the web server user can write, and confirm the bundle doesn't add a second, divergent upload path in its config.cache:clear (and warm up) — service definitions and Twig overrides are compiled.debug:container <id> and check for overridden definitions; a stray override can change behavior far from where you edited.formats, not this bundle. Verify formats resolve to actual filters.dump() calls, and missing tests before adopting. Read every PHP file — it's small — rather than assuming standard Symfony conventions.BaseProvider subclasses, event listeners on Sonata media events, Twig template overrides, and service decoration. Prefer these over editing the bundle so you can remove it cleanly later.debug:container | grep -i media, debug:config sonata_media, check sonata.media.provider.* tags, confirm the provider appears in admin media create form, then test upload + thumbnail generation end-to-end.How can I help you explore Laravel packages today?