dnl/mthaml
Laravel package integrating Haml templating via mthaml, enabling you to render .haml views with a concise, Ruby-like syntax. Useful for teams adopting Haml in PHP/Laravel projects and keeping view markup clean and expressive.
@stack, @push).@ directives (e.g., @foreach, @include), while HAML uses indentation. Mixing them requires custom parsers or strict separation (e.g., HAML-only partials).@stack, @push, or @inject.lessphp, coffeescript) that may bloat the project if not pruned.Why HAML Over Blade?
Migration Strategy
Performance Trade-offs
Team Adoption
Laravel Ecosystem Fit
Alternatives
Long-Term Viability
@stack, Livewire).Assessment Phase (1 week)
Pilot Phase (2 weeks)
Tooling Setup (1 week)
php artisan haml:compile
Incremental Rollout (4+ weeks)
@foreach in HAML vs. Blade’s @foreach).Optimization Phase (Ongoing)
Blade Integration Workarounds:
# resources/views/layouts/app.haml
!!!
%html
%head
= yield('head')
%body
= yield('content')
// In a controller
return view('layouts.app', [
'head' => view('partials.head'),
'content' => view('haml.page', ['data' => $data]),
]);
// app/Providers/BladeServiceProvider.php
Blade::directive('haml', function ($expression) {
return "<?php echo app('haml')->renderFile($expression); ?>";
});
@haml('resources/views/partials/haml_partial.haml')
Twig Compatibility:
resources/views/haml/).{% include %} to embed HAML-compiled templates.Dynamic Content:
- @foreach($items as $item)
%li= $item->name
Phase 1: Proof of Concept (2 weeks)
microtime(true)).Phase 2: Tooling (1 week)
Phase 3: Incremental Rollout (4+ weeks)
Phase 4: Optimization (Ongoing)
How can I help you explore Laravel packages today?