Download the PHP package havit/twig-components without Composer
On this page you can find all versions of the php package havit/twig-components. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download havit/twig-components
More information about havit/twig-components
Files in havit/twig-components
Package twig-components
Short Description Twig components extension
License MIT
Homepage https://github.com/iurigustavo/twig-components
Informations about the package twig-components
Twig components extension
This is a PHP package for automatically create Twig components as tags. This is highly inspired from Laravel Blade Components.
Installation
You can install the package via Composer:
Configuration
This package work only with Silex and PHP 7.1
To enable the package just pass your Twig environment object to the function and specify your components folder relative to your Twig templates folder.
SILEX
Create Provider
Usage
The components are just Twig templates in a folder of your choice (e.g. components
) and can be used anywhere in your Twig templates. The slot variable is any
content you will add between the opening and the close tag.
Named slots
Also with the standard syntax.
Attributes
You can pass any attribute to the component in different ways. To interprate the content as Twig you need to prepend the attribute name with a :
but it works
also in other ways.
snake-case variables will be converted to kebabCase
Call
Component
Compiled
Component Class
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.