Download the PHP package scylabs/hook-bundle without Composer
On this page you can find all versions of the php package scylabs/hook-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download scylabs/hook-bundle
More information about scylabs/hook-bundle
Files in scylabs/hook-bundle
Package hook-bundle
Short Description Templates and fonctionnal Hooks for symfony
License MIT
Informations about the package hook-bundle
ScyLabs Hook
Dynamic templating hook system for symfony.
Installation
To install this package, use composer .
Usage
The operation is very simple. First, you need to create entry points in your template, then connect PHP classes to these entry points.
I will explain in detail.
Create an entry point to connect hooks in twig
Okay , for the rest of the tutorial, we will say that the "entry point" is a door.
You can use the TwigExtension provided in this package.
The extension function has two parameters.
The first parameter is the target template NameSpace. Ex : layout.html.twig
The second parameter is the hook name and it is used to connect PHP classes in this door.
You can send _self in first parameter. _self is the current template NameSpace
It is important to add "raw" filter to interprete Hook's html.
You don't use twig ?
If you don't use twig , you can tell directly HooksFounder Service.
It works exactly like the extension, except that it directly returns an array of instantiated Hooks objects instead of hooks contents.
Connect Hooks to an entry point (door).
You can create an infinity of doors and an infinity of hooks to connect this doors.
To connect a hook to one door , you need to create a PHP class that extends AbstractHook class
I'ts the minimal code to connect a hook to a door. PS : You can connect one hook to many doors.
Last step : Add your Hook directory to the Container
I'ts done.
You can also show any hooks in your controller result in your SymfonyToolbar.
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
All versions of hook-bundle with dependencies
symfony/flex Version ^1.3.1
symfony/framework-bundle Version ^5.1
symfony/twig-pack Version ^1.0
symfony/yaml Version ^5.1