Installation Add the package via Composer:
composer require arachnias/foundationbundle
Register the bundle in config/bundles.php (Symfony) or config/app.php (Laravel via Symfony bridge):
Arachnias\FoundationBundle\ArachniasFoundationBundle::class => ['all' => true],
First Use Case Use the Twig helpers in a template. Example:
{% foundation_grid %}
{% foundation_column 6 %}
<h1>Hello Foundation!</h1>
{% endfoundation_column %}
{% endfoundation_grid %}
Where to Look First
src/Resources/views/ for available Twig extensions.README.md for basic usage examples.Responsive Grids
Use foundation_grid and foundation_column for responsive layouts:
{% foundation_grid %}
{% foundation_column 4 %}
<div>Column 1</div>
{% endfoundation_column %}
{% foundation_column 8 %}
<div>Column 2</div>
{% endfoundation_column %}
{% endfoundation_grid %}
Buttons and Forms
Leverage helpers like foundation_button or foundation_form:
{% foundation_button type="primary" %}
Submit
{% endfoundation_button %}
Modals and Tooltips
Use foundation_modal or foundation_tooltip for interactive elements:
{% foundation_tooltip text="Help text" %}
<span>Hover me</span>
{% endfoundation_tooltip %}
Integration with Laravel
Blade::render() or TwigBridge to mix Blade and Twig.AppServiceProvider:
public function boot()
{
$twig = $this->app['twig'];
$twig->addExtension(new \Arachnias\FoundationBundle\Twig\FoundationExtension());
}
Customizing Foundation Override default templates by extending Twig paths or creating custom blocks.
Twig Extension Conflicts
php artisan cache:clear
Foundation Version Mismatch
The bundle uses zurb/foundation:dev-master. Pin a stable version in composer.json to avoid breaking changes:
"require": {
"zurb/foundation": "6.*"
}
CSS/JS Not Loading
php artisan vendor:publish --provider="Arachnias\FoundationBundle\FoundationBundle"
app.blade.php or base.html.twig for included scripts.Twig Syntax Errors
{% raw %} for dynamic content to avoid Twig parsing issues:
{% raw var %}
config/twig.php:
'debug' => env('APP_DEBUG', true),
{{ dump(_context) }} to debug available Twig variables.Custom Twig Helpers Extend the bundle by creating a custom Twig extension:
class CustomFoundationExtension extends \Twig_Extension
{
public function getFunctions()
{
return [
new \Twig_SimpleFunction('custom_helper', [$this, 'customHelper']),
];
}
}
Override Templates
Copy templates from vendor/arachnias/foundationbundle/Resources/views/ to resources/views/vendor/foundation/ to customize.
Foundation Sass Integration
Import Foundation Sass variables in resources/sass/app.scss:
@import "~foundation-sites/scss/foundation";
How can I help you explore Laravel packages today?