Download the PHP package lmc/twigx-bundle without Composer
On this page you can find all versions of the php package lmc/twigx-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lmc/twigx-bundle
More information about lmc/twigx-bundle
Files in lmc/twigx-bundle
Package twigx-bundle
Short Description This is Symfony bundle which extends the twig implementation by an JSX like syntax.
License MIT
Informations about the package twigx-bundle
TwigX Bundle
Symfony bundle extending Twig template engine with JSX-like markup.
Requirements
- PHP 7.4 || 8.1
- Symfony 4.4+ || 5.4+ || ^6.1
- Twig >=1.44.6 || >=2.12.5 || 3+
Changelog
See CHANGELOG
How to install
Step 1
Download using composer
Install package
Step 2
Add TwigXBundle
into bundles (under all
bundles). If you use Symfony flex, it will be configured automatically.
bundles.php
Step 3 (optional)
If you want to change the default settings, create a config
config/packages/twigx.yml
Usage
Now you can use Twig components with HTML-like syntax in your Symfony project. You only need to remember that, unlike in HTML, component tags must always start with a capital letter:
You can pass attributes like this:
or pure original implementation
Allowed parenthesis
You can pass variables to props using two syntaxes.
JSX-like syntax uses single {...}
parentheses or Twig-like syntax that uses {{...}}
parentheses.
In both cases, there can be a whitespace around the value that is used.
See the examples below.
JSX-like syntax example:
Twig like syntax example:
if you want to extend these components, an example guide is here. if you want to contribute, read guide here.
All versions of twigx-bundle with dependencies
symfony/config Version ^4.4 || ^5.4 || ^6.1
symfony/dependency-injection Version ^4.4 || ^5.4 || ^6.1
symfony/http-foundation Version ^4.4 || ^5.4 || ^6.1
symfony/http-kernel Version ^4.4 || ^5.4 || ^6.1
symfony/polyfill-php80 Version ^1.23
symfony/polyfill-php81 Version ^1.26
twig/twig Version ^1.44.6 || ^2.12.5 || ^3.0.0
ext-simplexml Version *