Download the PHP package stillat/antlers-components without Composer
On this page you can find all versions of the php package stillat/antlers-components. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package antlers-components
Antlers Components is a Statamic addon that makes creating isolated, reusable Antlers partials easy and integrating existing Blade and Livewire components a breeze using a familiar syntax.
Installation
You may install Antlers Components using composer:
Requirements
Antlers Components requires at least PHP 8.1 and:
- Statamic version
3.4.*
or higher - Laravel
9.36
or higher
This package provides a familiar syntax for Livewire components, and it is compiled into the Antlers tags provided by this package:
https://github.com/marcorieser/statamic-livewire
In order to use the Livewire/Flux syntax, you will also need to install it using the following command:
For support/reporting issues related to the Livewire functionality beyond compilation errors, please use the following GitHub link:
https://github.com/marcorieser/statamic-livewire/issues
Using Blade Components
You may use Blade Components within your Antlers template using the syntax you are familiar with.
For example, to include a card
Blade component we may use the <x-card />
syntax. This package supports Blade component slots; you may use Antlers within the slot:
Using Antlers inside parameter values is acceptable.
Livewire Components
We can integrate existing Livewire components in our Antlers templates using the <livewire />
syntax like so:
Flux Components
If you'd like to use Flux components, ensure you've also installed the Livewire addon.
Flux v1 Styles and Scripts
Once you have Livewire and Flux installed in your site, you can use the flux
tag to add the required styles and scripts to your layout:
You may now use Flux components directly within your Antlers templates (or within your Livewire components if you are using Antlers for those).
Flux v2 Styles and Scripts
Once you have Livewire and Flux installed in your site, you can use the flux
tag to add the required styles and scripts to your layout:
You may now use Flux components directly within your Antlers templates (or within your Livewire components if you are using Antlers for those).
Supported Parameter Types
This package supports the following parameter types when compiling component tags to Antlers:
Shorthand Variables:
Variable References:
Name/Value:
Attribute:
Antlers Components
This package also supports the concept of Antlers "components", which are really just syntax sugar on top of partials (with a few special behaviors).
As an example, we could include a partial named partial-name.antlers.html
using this library like so:
Very Important: When using this syntax, the partials will not inherit the scope they were included in (except for the general Cascade). This means that if we want current data to be supplied to our partial, we must explicitly pass it in via. parameters.
The behavior of slots is also slightly different when using this syntax, and is closer to anonymous Blade components.
Let us consider an Antlers partial named _card.antlers.html
:
we can render this Antlers partial in our main template like so:
Note: We have to explicitly allow the current article's title and content values by supplying them via. parameters. Without this, it will default to the current page's values.
When using this syntax, we do not need to prefix named slots with slot:
inside our partial. Additionally, we also have access to an attributes bag. Parameters supplied to named slots will be available within the partial, as well:
Nesting Antlers Component Partials
We may also nest partial components by including them within other components. Like with regular components, we must specify what values we want to be passed along to our nested components:
We can check if we are inside a nested/child component using the __is_nested
variable:
We can also see how deeply nested we are using the __depth
variable:
And finally, we may access data from the parent partial if we are nested by referencing the __parent
variable:
If that parent has a parent, we can keep on going:
License
This addon is open-sourced software licensed under the MIT license.
All versions of antlers-components with dependencies
stillat/blade-parser Version ^1.2 || ^2
statamic/cms Version ^4 || ^5
laravel/framework Version ^9.36 || ^10 || ^11 || ^12