Download the PHP package arekx/html-processor without Composer

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

html-processor

PHP html processor using arrays

Why

Combining html tags is hard. Standard string concatenation just doesn't work, it's hard to sanitize the input and it just looks ugly. This approach uses arrays to fully create a structure which nicely translates to HTML. But what about template engines like Blade, Mustache, etc?

This was not supposed to replace them, even though it fully could. This was intended so that it can be used in programmatic places where you need to create tags dynamically like recursive menu generators, but do not want to use template engines. Examples for these are widgets which output html or in other places of the code where you would need to output programmatically.

So this:

Translates nicely into:

Usage

Self closing tags

Conditional rendering

You can conditionally render elements or text in arrays. If something is not to be rendered you can pass false and that part of the rendering will be skipped.

Using callbacks

You can also use callbacks in elements to handle conditional rendering. render($template, $config = []) function accepts additional optional parameter for configuration which will be passed to all callbacks used in the template array.

Attributes conditional rendering

If you pass true to an attribute you will just render that attribute without a value:

NOTE: All attribute values rendered are encoded using htmlspecialchars.

If you pass false as a value to any attribute that attribute wont be rendered:

Value for attribute can also be a callback:

Special attributes

If you look closely class="class1 class2" in above example, it is rendered using 'class' => ['class1', 'class2']. There are special renderers for few fields like class and style which allows non-string values which can be parsed.

class attribute allows an array which will be joined with all false values removed. It also allows for a class value to be a callable.

style attribute allows for ['property' => 'value'] which will render to property: value. Value can also be a callable which will get executed to return property value. If a property value is false it will be skipped.

Json attributes

You can encode arrays as json in attributes:

Testing


All versions of html-processor with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
ext-json Version *
ext-mbstring Version *
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 arekx/html-processor contains the following files

Loading the files please wait ....