Download the PHP package aviator/html without Composer

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

travis-badge Latest Stable Version License

Html

Html is a simple package for building snippets of valid HTML. It can be used to augment a templating system where you want to encapsulate more logic in a class vs a template file.

Getting Started

Prerequisites

This package requires PHP 7 or higher.

Installing

Via Composer:

Testing

Run:

Usage

Tags

To build a block of HTML, make a new tag:

Or, using the static constructor:

Or, using magic static calls:

Or, using the global helper function:

To render the tag, call render():

Which produces:

The Tag class will only accept valid HTML tags. Trying to create an invalid tag will throw an exception.

Content

Tags can have contents. You can pass in a string, a Tag, or an array of either or both.

Strings

Use the with() method to add content to a tag:

This will render as:

Additionally, with() will attempt to get a string representation of any non-string, non-renderable passed in, including objects that implement __toString().

Nested Tag

Tags can be nested:

Render:

Array

You can also use an array:

Which will render:

Void tags

The Tag class knows which tags are void and need no closing tag. There's no need to do anything for <input>, <hr>, etc.

Void tags cannot have content. Trying to add content to them will throw an exception.

Fragments

Direct siblings can be rendered using a Fragment. A fragment is simply an un-nested collection of tags (or other renderables, even other fragments):

$fragment->render():

Conditional Tags

You can create a conditional tag that will only render sometimes:

or

$tag->render():

CSS Classes

To specify CSS classes for your tags, pass in a second parameter:

Render:

Multiple CSS classes may be passed in via array:

Render:

After instantiation

If you need to add classes after instantiation, you can call addClass(), which accepts the same string or array as the constructor:

Attributes

Attributes are passed in as the third parameter. Attributes with values are passed by association. Boolean attributes are simply a value.

Render:

After instantiation

If you need to add attributes after instantiation, you can call addAttribute(), which accepts the same array as the constructor:

Validation

Attributes are validated to make sure they belong to the tag you've applied them to. For instance adding the max attribute to a <div> will throw an exception.

Getting attribute values

If you want to retrieve an attribute from a Tag instance, call attribute($name). If your attribute exists you'll get the value (boolean attributes always return true), otherwise you'll get null.

Options

If you want to render an open tag, call the dontClose() method:

Result:


All versions of html with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.0
cocur/slugify Version ^4.0
aviator/delegate Version 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 aviator/html contains the following files

Loading the files please wait ....