PHP code example of setono / tag-bag-bundle
1. Go to this page and download the library: Download setono/tag-bag-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
setono / tag-bag-bundle example snippets
// config/bundles.php
return [
// ...
Setono\TagBagBundle\SetonoTagBagBundle::class => ['all' => true],
// ...
];
use Setono\TagBag\Tag\InlineScriptTag;
use Setono\TagBag\TagBagInterface;
class YourService
{
private $tagBag;
public function __construct(TagBagInterface $tagBag)
{
$this->tagBag = $tagBag;
}
public function method(): void
{
$this->tagBag->addTag(
InlineScriptTag::create('console.log("This will be output in the console");')
);
}
}