Download the PHP package yetii/html-element without Composer

On this page you can find all versions of the php package yetii/html-element. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package html-element

HTML Element (DISCONTINUED - NO LONGER MAINTAINED)

Provides a more robust alternative to generating HTML

Requires

Usage

The using is fairly simple. Firstly, you have the different Elements under the YeTii\HtmlElement\Elements namespace, for example a <div> element is YeTii\HtmlElement\Elements\HtmlDiv, an <input> element is YeTii\HtmlElement\Elements\HtmlInput, etc. This is except for the YeTii\HtmlElement\TextNode. See below for full list of classes.

Basic Usage:

The first argument for the Element is an array of attributes (key => value).

The second being an optional (not really used at the moment) name to override the default name. The default name is the class name in lowercase, stripped of the Html prefix, for example HtmlInput is rendered using the name input). This argument may be removed in future versions, the idea was to be able to support Vue-like component names. Alternatively you can use $element->setName($name); to set a name (and $element->getName(); to retrieve it)

Child Elements:

You can specify a child by providing a node or nodes "attribute" as a quickhand for adding a child node or multiple children nodes. Alternatively, you can go: $parent->addChild(Element $child); or $parent->addChildren(array $children);

Text Nodes:

If you provide a string as a child element(s), it's automatically converted into a text node element.

Text node Elements can only have text child elements, which are contacted together when rendered. You may manually specify a TextNode instance:

Things to note:

The order you specify the attributes correlates to the order they are rendered.

htmlspecialchars:

You can also specify whether or not to encode html special characters by doing the following:

Currently, inheritance does NOT apply to escaping of HTML, meaning that if the parent Element is escaping HTML and you provide a child Element, and that child Element has a text node with HTML - it will NOT be escaped. You must define whether or not to escape the HTML per Element. Take the following as an example:

The text nodes that are immediate children are escaped, but the $child does not inherit that, so it does not escape the HTML in the text node.

Should you want a child Element to NOT escape HTML, but would like the immediate parent to, you may do so by doing the following:

Full list of Element classes:

Interfaces:

These interfaces change the way an element is rendered.

Custom Elements:

You may want to create some custom elements, especially if generating something like vue component templates. Using the interfaces above, and extending the base Element class, it becomes a very easy task. Say you want an singleton element like <dob-picker type="date" {customAttributesHere} />


All versions of html-element with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yetii/html-element contains the following files

Loading the files please wait ....