Weave Code
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
Easy Block Bundle

Easy Block Bundle Laravel Package

agence-adeliom/easy-block-bundle

Symfony bundle adding a basic block component for EasyAdmin: manage blocks via a CRUD interface and render them in Twig. Supports Symfony 6.4/7.x (PHP 8.2+), with older branches for Symfony 5.4/6.x and 4.4/5.x.

View on GitHub
Deep Wiki
Context7

A Symfony bundle for EasyAdmin that provide basic blocks components

Frequently asked questions about Easy Block Bundle
Is Easy Block Bundle compatible with Laravel, or is it only for Symfony?
Easy Block Bundle is designed exclusively for Symfony projects using EasyAdmin. While Laravel has similar packages like *spatie/laravel-blocks*, this bundle is not compatible with Laravel due to its Symfony-specific dependencies like Twig, Doctrine, and EasyAdmin integration.
How do I install Easy Block Bundle in a Symfony 6.4+ project?
First, add the Flex recipe endpoint to your `composer.json` under `extra.symfony.endpoint`, then run `composer require agence-adeliom/easy-block-bundle`. After installation, generate and run Doctrine migrations (`php bin/console doctrine:migration:diff` and `php bin/console doctrine:migration:migrate`) to create the block tables.
Can I use this bundle with older Symfony versions like 5.4 or 4.4?
Yes, but you’ll need to install a specific branch: use `2.x` for Symfony 5.4/6.x (PHP 8.0.2+) or `1.x` for Symfony 4.4/5.x (PHP 7.2.5+). The `3.x` branch is for Symfony 6.4/7.x (PHP 8.2+) only. Check the [README](https://github.com/agence-adeliom/easy-block-bundle) for branch-specific installation commands.
How do I render a block in Twig templates?
After installation, use the provided Twig function `{{ render_block('block-slug') }}` in your templates. Blocks are managed via the EasyAdmin CRUD interface, and their content is stored in the database. You can also pass additional options like `{{ render_block('hero', {'class': 'custom-class'}) }}` for custom styling.
Does this bundle support caching blocks to improve performance?
The bundle itself doesn’t include built-in caching, but you can implement Symfony’s cache system (e.g., `cache:pool`) to cache rendered blocks. For example, wrap the Twig render call in a cache tag: `{% cache 'block_hero' %}{{ render_block('hero') }}{% endcache %}. This reduces database queries for frequently used blocks.
Can I associate blocks with other entities, like Articles or Products?
Yes, the bundle supports Doctrine entity associations. For example, you can add a `ManyToOne` or `OneToMany` relationship in your entity (e.g., `Article` or `Product`) to link blocks. The EasyAdmin CRUD interface will automatically include the block field for selection, as shown in the [documentation](https://github.com/agence-adeliom/easy-block-bundle).
What happens if a block fails to render (e.g., missing template or database error)?
The bundle doesn’t include a fallback mechanism by default, but you can handle errors in Twig using `{% if render_block('hero') is not empty %}...{% else %}...{% endif %}` or create a custom Twig extension to log errors and display a default message. For production, consider wrapping the render call in a try-catch block in your controller.
Are there alternatives to Easy Block Bundle for Symfony/EasyAdmin?
If you’re looking for alternatives, consider *FOSCKMS* (for content management) or *SonataAdminBundle* (which includes block support). For Laravel, *spatie/laravel-blocks* is a popular choice. However, Easy Block Bundle is lightweight and specifically designed for EasyAdmin, making it a straightforward option if you’re already using that bundle.
How do I customize the block templates or add new block types?
Block templates are stored in `templates/blocks/` by default. Override them by creating a matching directory in your project (e.g., `templates/blocks/custom_block.html.twig`). For new block types, you’ll need to extend the bundle or fork it, as the core package focuses on basic text/HTML blocks. Check the [GitHub issues](https://github.com/agence-adeliom/easy-block-bundle/issues) for community contributions.
Does Easy Block Bundle work with Symfony’s security system (e.g., role-based access)?
Yes, block access is controlled by Symfony’s security system. You can restrict block visibility in Twig using `{% if is_granted('ROLE_USER') %}{{ render_block('user_block') }}{% endif %}` or configure EasyAdmin’s CRUD permissions to limit who can create/edit blocks. The bundle inherits Symfony’s security context by default.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky