Download the PHP package gin0115/elmishphp-html without Composer

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

Elmish PHP — HTML

A functional library for creating HTML in PHP, heavily inspired by Elm's Html package. Each element is a typed value object with __toString — compose them with curried functions, render by stringification.

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require GitHub contributors GitHub issues PHP — PHPUnit + PHPStan Level 8 E2E (Playwright) codecov

Why

Erm, next question........ok fine, why not. I really enjoyed ELMs approach to creating HTML and have played around with this idea before (Functional WP Plugin).

Install

Then the usual require 'vendor/autoload.php' and you're good to go.

How it works

Each HTML tag is a curried function. The first call passes attributes, the second passes children. Every function returns a typed object that knows how to render itself.

Elm-style formatting

For longer trees, leading-comma style mirrors elm-format:

Text content

escapes? use for
text('...') yes the default for any string
raw('<b>x</b>') no pre-rendered HTML you trust
bare 'string' yes (auto) shorthand for text('string') as a child

Attributes

Attributes are an associative array. Three forms:

All attribute values are HTML-escaped. Keys are not (they're under your control).

Void elements

Void elements take attributes only — no second call for children:

The void set: br, hr, img, input, wbr, col, source, track.

Custom tags via node()

For anything not in the built-in set:

Type hierarchy

Everything renderable shares a small interface tree — useful for categorisation and type-narrowing in your own code:

Every element function returns its concrete typed class (e.g. div(...)(...) returns Gin0115\ElmishPHP\HTML\Element\Div), so you can instanceof BlockElement or pass them around with full type info.

Supported tags

77 standard HTML elements out of the box.

Category Tags
Block div, p, h1h6, pre, blockquote, ul, ol, li, dl, dt, dd, figure, figcaption, hr
Inline span, a, strong, em, small, b, i, u, mark, code, kbd, samp, sub, sup, time, abbr, cite, q, br, wbr
Sectioning header, footer, main, nav, section, article, aside
Form form, fieldset, legend, label, button, select, optgroup, option, textarea, input
Table table, caption, colgroup, thead, tbody, tfoot, tr, td, th, col
Media img, iframe, video, audio, canvas, picture, source, track
Interactive details, summary, dialog

For anything else, use node('tag-name', ...).

Tests

PHPUnit (unit / behaviour):

Playwright (browser-driven E2E against the kitchen-sink fixtures):

The kitchen-sink fixture at tests/e2e/views/kitchen-sink.php exercises every category — visit http://localhost:57893/?fixture=kitchen-sink while the server is up.

Requirements

License

GPL-2.0-or-later


All versions of elmishphp-html with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2.0
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 gin0115/elmishphp-html contains the following files

Loading the files please wait ...