Skip to content

object oriented library for generating html snippets

License

Notifications You must be signed in to change notification settings

spider-mane/html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

html

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

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 [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

object oriented library for generating html snippets

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published