grzegorz-jamroz / html-creator
There is no license information available for the latest version (0.0.4) of this package.
Library allow to generate html for React page readable by seo robots.
0.0.4
2021-03-21 16:19 UTC
Requires
- php: >=8
- grzegorz-jamroz/plain-data-transformer: ^0.0.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.18
- phpstan/phpstan: ^0.12.78
This package is auto-updated.
Last update: 2024-10-26 21:47:47 UTC
README
Description
Library allow to generate html for React pages readable by seo robots.
Instalation
composer require grzegorz-jamroz/html-creator
Usage
use HtmlCreator\ContentBuilder; use HtmlCreator\Helmet; use HtmlCreator\PageBuilder;use HtmlCreator\PageFactory; $data = [ 'seo' => [], 'header' => 'Page title', 'navbar' => [ 'items' => [ [ 'name' => 'Home', 'url' => '/home', ], [ 'name' => 'About', 'url' => '/about', ], [ 'name' => 'Contact', 'url' => '/contact', ], ], ], 'sections' => [], 'footer' => [ 'text' => 'Copyright ©' ], ]; $pageBuilder = new PageBuilder( 'en', '/path/to/your/app.js', '/path/to/your/styles.css', Helmet::createFromArray($data['seo'] ??= []), ContentBuilder::createFromArray($data), ); $html = (new PageFactory($pageBuilder))->getHtml();