dreadlabs/kunstmaan-config-bundle
Installation
composer require dreadlabs/kunstmaan-config-bundle:*
Register the Bundle
Add to AppKernel.php (or bundles.php in Symfony 4+):
new DreadLabs\KunstmaanConfigBundle\DreadLabsKunstmaanConfigBundle(),
Configure parameters.yml.dist
Add the required parameter:
liipimagine_webroot: '%kernel.root_dir%/../web'
Update config.yml
Integrate the bundle’s compiler pass for LiipImagineBundle:
liip_imagine:
resolvers:
default:
web_path:
web_root: '%liipimagine_webroot%'
loaders:
default:
filesystem:
data_root: '%liipimagine_webroot%'
First Use Case
After installation, the bundle automatically aligns Kunstmaan’s media filesystem adapter with LiipImagineBundle’s expected paths. Test by uploading media via Kunstmaan’s admin panel and verifying image transformations (e.g., thumbnails) render correctly in the web/ directory.
Media Path Standardization
LiipImagineBundle’s webroot by overriding the kunstmaan_media.filesystem_adapter compiler pass.liipimagine_webroot in parameters.yml.dist and let the bundle handle the rest. No manual path adjustments are needed in Kunstmaan’s media configuration.Integration with LiipImagine
LiipImagineBundle to use the same root path (web/) for both image resolution and filesystem loading.web/uploads/, LiipImagineBundle will automatically resolve and load images from the same directory without additional mapping.Environment-Specific Paths
liipimagine_webroot in environment-specific configs (e.g., config_dev.yml):
liipimagine_webroot: '%kernel.root_dir%/../web/dev'
%kernel.root_dir% and %kernel.project_dir% placeholders to dynamically reference paths across environments.php bin/console cache:clear
to ensure compiler passes are re-evaluated.LiipImagineBundle’s configured paths by default. Verify uploads appear in the expected web/ directory.Compiler Pass Timing
LiipImagineBundle is loaded. If you manually configure kunstmaan_media.filesystem_adapter in code (e.g., via a service), the bundle’s override may not apply. Solution: Avoid hardcoding paths; rely on the bundle’s configuration.Path Mismatches
liipimagine_webroot points to a non-existent directory, LiipImagineBundle will fail to resolve images. Solution:
post-install script).config.yml match the actual filesystem structure.Symfony 4+ Compatibility
AppKernel. For Symfony 4+, ensure the bundle is registered in config/bundles.php and compiler passes are triggered via Kernel events (the bundle may need updates for full compatibility).Media Permissions
web/ directory. Solution:
chmod -R 775 %kernel.project_dir%/web
php bin/console debug:container kunstmaan_media.filesystem_adapter
$this->container->setParameter('debug.liipimagine_webroot', '%liipimagine_webroot%');
Custom Paths
Extend the bundle by overriding the kunstmaan_media.filesystem_adapter parameter in config.yml:
parameters:
kunstmaan_media.filesystem_adapter: custom.path.adapter
Then define the service in services.yml.
Dynamic Paths Use a service to generate paths dynamically (e.g., based on environment variables):
liipimagine_webroot: '%env(MEDIA_WEBROOT)%'
Requires Symfony Flex or manual environment variable loading.
Additional Bundles
The bundle is opinionated for LiipImagineBundle. For other media bundles (e.g., VichUploaderBundle), manually configure path alignment in config.yml.
How can I help you explore Laravel packages today?