evheniy/materialize-bundle
MaterializeBundle integrates the Materialize CSS framework into Symfony2 via cdnjs CDN, with optional local JS, CSS, and font sourcing configured through config.yml. Includes Assetic support and Twig template includes for styles and scripts.
This is a Symfony2 bundle, not a Laravel package — the first thing to internalize. It does one narrow job: inject a pinned Materialize build (CSS + JS) hosted on cdnjs into your templates so you don't hand-maintain <link>/<script> tags. There is no build step, no npm, no Sass pipeline. That is both the appeal and the limitation.
Minimal setup (Symfony side):
composer require evheniy/materialize-bundleapp/AppKernel.php:
$bundles = [
// ...
new Evheniy\MaterializeBundle\MaterializeBundle(),
];
Resources/views/ and the Twig extension in src/ — this bundle's surface area is tiny, so a few minutes of reading the extension tells you everything).<head>/before </body>.Where to look first: the Twig extension class and Resources/views/ — that's where the CSS/JS inclusion logic lives. There is no config tree worth inspecting.
First use case: a Symfony2 admin or prototype app that needs Materialize's grid, cards, and form components with zero front-end tooling. Drop the helpers in base.html.twig and start writing .row/.col markup.
If you're actually on Laravel: you cannot composer require this and expect it to work. Extract the idea, not the code — see Gotchas.
Base-layout injection (the intended pattern). Put the CSS helper in <head> and the JS helper just before </body> in your single base.html.twig. Every page inherits Materialize. This is the 90% case and the bundle is designed around it.
Per-layout variants. If you have a public layout and an admin layout, include the helpers in each explicitly rather than relying on a global bundle config. This bundle has almost no configurability, so explicit includes are clearer than fighting it.
Composing with Symfony's asset management. Because the bundle references cdnjs URLs directly, it sidesteps Assetic/webpack entirely. That's fine for prototypes and bad for production hardening — you have no cache-busting fingerprint of your own and no self-hosted fallback. If you need offline builds or strict CSP, wrap the output or fork the Twig template to point at locally vendored files.
Component markup discipline. The bundle gives you the library, not components. You still write Materialize's class vocabulary (input-field, btn, collection, modal). Standardize on a small set of partials (_card.html.twig, _form_field.html.twig) so upgrades — if they ever happen — are localized.
Materialize JS initialization. Materialize's interactive widgets (modals, selects, side-nav, datepicker) require explicit $('.modal').modal()-style init. The bundle ships the JS but not the init calls; add a tiny app.js that initializes widgets on DOM ready, otherwise forms look broken on first load.
Porting the pattern to Laravel (recommended path for you). Skip the bundle; register a Blade directive or a @include('partials.materialize') that emits the same cdnjs tags:
@push('styles')
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/materialize.min.css">
@endpush
@push('scripts')
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/materialize.min.js"></script>
@endpush
That is, functionally, the entire value proposition of this bundle — twenty lines of Blade.
It is abandoned and ancient. Last release 2016-06-06, 6 stars, 0 dependents. The Materialize version it serves is ~0.97.x. Do not plan a 2024+ front-end on it. Treat it as a curiosity or a fast prototype scaffold.
Materialize 0.97 requires jQuery. Unlike Materialize 1.0+, the era this bundle targets expects jQuery loaded before materialize.min.js. If modals/selects silently fail, that's the cause nine times out of ten — not a broken CDN.
CDN-only means your app depends on cdnjs uptime. No local fallback is built in. In air-gapped CI, behind aggressive corporate firewalls, or under a strict Content-Security-Policy (no cdnjs.cloudflare.com in script-src/style-src), pages render unstyled and the console fills with CSP violations. Check the network tab first when "it works locally but not in staging."
Version drift on the CDN. cdnjs keeps old versions, but if the bundle's hardcoded URL ever points at a path cdnjs removes or reorganizes, you get 404s with no config knob to override. Fork the Twig template and pin the URL yourself if you must ship this.
Symfony2 only — hard stop for Laravel. The bundle registers via AppKernel/Bundle classes that do not exist in Laravel's container. Do not try to shoehorn it into config/app.php. Use the Blade/CDN approach above instead.
No asset pipeline means no purging, minification control, or tree-shaking. You ship the whole Materialize CSS (~130 KB) and JS regardless of what components you use. Acceptable for a prototype, wasteful for a public site.
Debugging checklist: (1) asset tags present in rendered HTML? (2) cdnjs URLs return 200 in the network tab? (3) jQuery loaded before Materialize JS? (4) any CSP console errors? (5) is the widget's init call actually executed? Those five cover essentially every failure mode.
Extension point: the Twig template in Resources/views/ is the only real customization seam. Override it (or copy and edit) to change CDN version, add SRI integrity/crossorigin attributes, or point at self-hosted assets — which is what you should do before shipping anything to production.
How can I help you explore Laravel packages today?