elao/theme-elaostrap-bundle
Symfony bundle providing the ElaoStrap theme for Elao Theme Bundle, including ready-to-use form themes and Twig helpers. Install via Composer and enable the bundle to apply ElaoStrap styling in your app.
Installation Add the bundle to your Laravel project via Composer (if using Symfony/Laravel bridge):
composer require elao/theme-elaostrap-bundle
Register the bundle in config/bundles.php (Symfony) or AppServiceProvider (Laravel):
// For Symfony
Elao\Theme\ElaoStrapBundle\ElaoThemeElaoStrapBundle::class => ['all' => true],
Enable the Theme
Configure config/packages/elao_theme.yaml (Symfony) or config/elao_theme.php (Laravel):
theme: elao_strap
First Use Case
Extend a base template (e.g., base.html.twig) in templates/elao_strap/:
{% extends 'elao_strap/base.html.twig' %}
{% block body %}
<h1>Hello, ElaoStrap!</h1>
{% endblock %}
Template Overrides
Override default Twig templates in templates/elao_strap/ (e.g., layout.html.twig, navbar.html.twig).
Example:
{% block navbar %}
{{ parent() }} <!-- Extend parent block -->
<div class="custom-nav-item">My App</div>
{% endblock %}
Dynamic Assets Use Twig functions to load assets (CSS/JS) dynamically:
{{ asset('bundles/elaostrap/css/main.css') }}
Service Injection
Bind Symfony services to Laravel via AppServiceProvider:
public function register()
{
$this->app->singleton('elao.theme', function ($app) {
return $app->make('elao_theme');
});
}
Event Listeners
Subscribe to elao_theme.events (Symfony) or elao.theme (Laravel) for theme lifecycle hooks:
// Symfony Event Listener
public function onThemeInit(ThemeInitEvent $event) {
$event->setOption('custom_var', 'value');
}
webpack.config.js to process ElaoStrap assets:
Encore
.addEntry('elaostrap', './vendor/elao/theme-elaostrap-bundle/resources/assets/js/main.js')
.enableSassLoader()
Template Caching Clear Twig cache after overrides:
php bin/console cache:clear --env=prod
Laravel: php artisan view:clear.
Asset Paths
Verify public_path() (Laravel) or %kernel.project_dir% (Symfony) in asset URLs to avoid 404s.
Theme Fallback
If elao_strap fails, ensure a fallback theme is set in elao_theme.yaml:
fallback_theme: bootstrap_4
Deprecated Features
Check ElaoThemeElaoStrapBundle for deprecated methods (e.g., getThemeConfig() → getOptions()).
Custom Components Extend Twig with custom filters/filters:
{% filter custom_filter %}
{{ variable }}
{% endfilter %}
Register in services.yaml (Symfony) or AppServiceProvider (Laravel).
CSS/JS Overrides
Use !important sparingly; prefer BEM methodology for scoped styles:
.elao-strap-component {
&__element { ... }
}
How can I help you explore Laravel packages today?