Erin Dalzell

Blade Directives

Erin Dalzell

MIT Licensed

This package provides custom directives so you can easily access Statamic data in your Blade templates.

Requirements

  • PHP 7.4+
  • Statamic v3

Installation

You can install this package via composer using:

composer require edalzell/blade-directives

The package will automatically register itself.

Usage

Bard

@bard($entry['content'])
    <p>Type is {{ $set['type'] }}</p>
    @include("partials/{$set['type']}", [ 'data' => $set['content']])
@endbard

Collection

 @collection('pages', ['where' => 'title:My Title,author:Erin', 'limit' => 3, 'orderBy' => 'title:desc'])
   {{ $entry['title'] }}
 @endcollection

Globals

@globalset('footer')
    {{ $set_variable }}
@endglobalset

@globalset('footer', 'set_variable')

Testing

Run the tests with:

vendor/bin/phpunit

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.