Download the PHP package hexmakina/marker without Composer

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

Scrutinizer Code Quality Maintainability

PSR-4 Compliant PSR-12 Compliant PHP 7.4 Required

Latest Stable Version License

Marker

HTML generation classes for PHP.

Hommage to Christian François Bouche-Villeneuve aka Chris Marker.

Installation

All classes live in the HexMakina\Marker namespace:

Contents


Class Element

Element builds a single HTML element. Its __toString() renders the tag, its attributes, and its inner content. You can construct it directly or use the static shorthand.

Static shorthand

Any undefined static call is treated as a tag name. The first argument is the inner content, the second the attributes array:

Escaped text versus trusted HTML

By default, inner content and attribute values are escaped with htmlspecialchars(..., ENT_QUOTES). This is the safe default: any value coming from user input is neutralised.

The escaping behaviour is controlled by the fourth constructor argument, $formatter:

$formatter value Effect
null (default) or omitted Escapes with htmlspecialchars(..., ENT_QUOTES).
false Trusted mode: content and attributes are emitted verbatim.
a callable Custom formatter applied to every value.

Use false only when the content is already safe markup that you produced yourself. This is what lets you nest elements:

⚠️ Nesting pitfall. If you concatenate a child element into a parent that uses the default (escaping) formatter, the child's tags are escaped:

To nest safely, pass false as the formatter on the parent (as above), so the parent trusts the already-escaped child. Do not use false on an element whose own content is untrusted user data.

Void elements

Void elements (area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr) are rendered without a closing tag. Pass null as the content:

Any content passed to a void element is ignored — a void tag never has a body.

Boolean attributes

In the attributes array, an entry with an integer key (i.e. a bare value with no =>) is rendered as a boolean attribute — just its name, no value. String-keyed entries render as name="value".

Attribute and tag name validation

Tag and attribute names must match ^[a-zA-Z][a-zA-Z0-9-]*$. An invalid name throws \InvalidArgumentException:

Attributes can also be read, set, checked, and removed as properties:


Class Marker

Marker extends Element with two shortcuts whose argument order reads more naturally than the generic form.

Both accept an optional fourth $formatter argument with the same meaning as on Element (null to escape, false to trust).


Class Form

Form builds form controls, each optionally paired with a <label>. Field values and attributes are always escaped; only the assembled label+field markup is treated as trusted so its own tags are not double-escaped.

Inputs

The id defaults to the field name. If there is no name/id, no empty id attribute is emitted.

Any input type is available through the static shorthand — the method name becomes the type:

A type you pass explicitly is respected — including on disabled fields:

Form labels

A label entry in the attributes array attaches a label. Two layouts:

Sibling label (default) — a <label for="id"> next to the field:

Wrapping label — set label-wrap to nest the field inside the <label>. This is also used automatically when the field has no id to bind a sibling label to:

The internal keys label, label-wrap, and tag are stripped before rendering and never appear as HTML attributes.

Textarea and select

The selected option is matched by a strict comparison of the string forms of the selected value and each option key, so a numeric-string selected value still matches an integer array key without loose-typing surprises.

Buttons


Accessibility helper (removed)

Earlier versions shipped a WCAGElement class that enforced a handful of accessibility rules (required alt on <img>/<area>, <figcaption> inside <figure>, title on <iframe>, href on <a>, lang on <html>, and so on). This class has been removed and is no longer part of the package.

tests/WCAGElementTest.php still references the removed class and will fail until it is deleted or the class is deliberately reintroduced. Do not rely on WCAGElement — it does not exist in src/.


All versions of marker with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
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 hexmakina/marker contains the following files

Loading the files please wait ...