webtheory / html
Create html strings from structured data
Installs: 1 168
Dependents: 7
Suggesters: 1
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.4||^8.0
Requires (Dev)
- behat/behat: ^3.10
- captainhook/captainhook: ^5.10
- fakerphp/faker: ^1.16
- friendsofphp/php-cs-fixer: ^3.4
- maximebf/debugbar: ^1.17
- mockery/mockery: ^1.4
- monolog/monolog: ^2.0
- oscarotero/env: ^2.1
- pdepend/pdepend: ^2.10
- phpbench/phpbench: @dev
- phpcompatibility/php-compatibility: ^9.3
- phpspec/phpspec: ^7.1
- phpspec/prophecy-phpunit: ^2.0
- phpstan/phpstan: ^1.6
- phpunit/phpunit: ^9.5
- phpunit/phpunit-selenium: ^9.0
- psy/psysh: ^0.11
- rector/rector: ^0.12.22
- spatie/phpunit-watcher: ^1.12
- squizlabs/php_codesniffer: ^3.5
- symfony/thanks: ^1.1
- vimeo/psalm: ^4.22
- vlucas/phpdotenv: ^5.4
- webtheory/exterminate: @stable
README
Clean interface for programmatically creating and manipulating html strings. Useful where desired output depends on various conditions or is otherwise fairly complex, but too brief to justify a template.
This project is still in early development.
Install
Via Composer
composer require webtheory/html
Usage
Create one-offs by using the Html static class:
use WebTheory\Html\Html; use WebTheory\Html\Attributes\ClassList; $age = 24; $attributes = [ 'id' => $age >= 21 ? 'real-id' : 'fake-id', 'class' => new ClassList(['dummy-class', 'dummy-class-2']), ]; $content = 'This is a test'; echo Html::tag('h1', $content, $attributes);
Or create reusable elements by extending the AbstractHtmlElement class:
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email spider.mane.web@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.