Download the PHP package one234ru/html-tag-generator without Composer

On this page you can find all versions of the php package one234ru/html-tag-generator. 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-tag-generator

ПО-РУССКИ

HTML tags source code generation based on configuration array

Installation

Composer

Manual

The library doesn't have any dependencies. Only HTMLtagGenerator.php file is required for work.

Usage

Create the object passing configuration array to the constructor. Then get an HTML code treating the object as a string:

Description of configuration fields

tag and text

tag is the tag's name, div by default.

text will be inserted right after opening tag.

Examples

Configuration:

Result:

Configuration:

Result:

Tags with no closing part (like input) will be detected automatically and processed appropriately.

attr

attr is a list of attributes in a form of key-value pairs.

All the values are encoded using htmlspecialchars().

If the value is an array, it will be turned into JSON.

Result (formatted for readability):

Some attributes, like checked, are treated in a special way: if the value converts to boolean true, only their names go to final HTML, otherwise nothing goes anywhere:

This is done for disambiguation of unobvious feature deriving from HTML standard, which leads to <input checked=""> or <input checked=0> eventually working the same way as <input checked>, i.e. the actual value of the attribute not affecting anything even if it is false or something like that, and the only way to discard the attribute is to exclude it completely.

children

The children field serves for listing of children elements in the form of similar configurations.

Their source code will be inserted after text:

You can pass HTML as a string directly instead of an array:

It is not necessary to wrap the contents into tags:

Actually, the following two configurations yield the same result:

If a string is passed as a configuration, it will be used as final HTML; this fact is utilized when children are passed as strings. The following two configurations are equivalent:

Result:

Inheritance: normalizing configuration (normalizeConfig())

When extending the class, you may define protected normalizeConfig() method, which allows using configurations of non-standard structure.

Let's say, we often use class attribute and would like to define it at the highest level of array, not inside the attr. In this case we need to create a child class:

Result:


All versions of html-tag-generator with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
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 one234ru/html-tag-generator contains the following files

Loading the files please wait ....