Download the PHP package neos/fusion-afx without Composer

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

Neos.Fusion.Afx

JSX inspired compact syntax for Neos.Fusion

_This repository is a read-only subsplit of a package that is part of the Neos project (learn more on www.neos.io <https://www.neos.io/>).__

This package provides a fusion preprocessor that expands a compact xml-ish syntax to pure fusion code. This allows to write compact components that do'nt need a seperate template file and enables unplanned extensibility for the defined prototypes because the generated fusion-code can be overwritten and controlled from the outside if needed.

Installation

Neos.Fusion.AFX is available via packagist. Just add "neos/fusion-afx" : "~1.0.0" to the require-section of the composer.json or run composer require neos/fusion-afx.

We use semantic-versioning so every breaking change will increase the major-version number.

Usage

With this package the following fusion code

Will be transpiled, parsed and then cached and evaluated as beeing equivalent to the following fusion-code

AFX Language Rules

All whitepaces around the outer elements are ignored. Whitepaces that are connected to a newline are considered irrelevant and are ignored.

HTML-Tags (Tags without Namespace)

HTML-Tags are converted to Neos.Fusion:Tag Objects. All attributes of the afx-tag are rendered as tag-attributes.

The following html:

Is transpiled to:

If a tag is self-closing and has no content it will be rendered as self closing fusion-tag:.

Is transpiled to:

Fusion-Object-Tags (namespaced Tags)

All namespaced-tags are interpreted as prototype-names and all attributes are passed as top-level fusion-properties.

The following html:

Is transpiled as:

Spread Syntax

To apply multiple properties to a fusion prototype with a single expression afx supports the spread syntax from ES6:

Is transpiled as:

Spreads can be combined with props and the order of the definition is of props and spreads is preserved, spreads will override previously defined props but are overwritten again by later props.

The order preserving combination of spreads and properties works by only rendering the properties before the first spread as classic fusion properties. Spreads and the following props are transpiled to fusion @apply statements and are thus able to override all props but and are evaluated in the order of definition.

Is transpiled as:

This feature is based on the @apply-syntax of fusion and thus will only work in Neos > 4.2.

Tag-Children

The handling of child-nodes below an afx-node is differs based on the number of childNodes that are found.

Single tag-children

If a AFX-tag contains exactly one child this child is rendered directly into the content-attribute. The child is then interpreted as string, eel-expression, html- or fusion-object-tag.

The following AFX-Code:

Is transpiled as:

Multiple tag-children

If an AFX-tag contains more than one child the content is are rendered as Neos.Fusion:Join into the content-attribute. The children are interpreted as string, eel-expression, html- or fusion-object-tag.

The following AFX-Code:

Is transpiled as:

The @key-property of tag-children inside alters the name of the fusion-attribute to recive render the array-child into. If no @key-property is given index_x is used starting by x=1.

Is transpiled as:

The @path-property of tag-children can be used to render a specific afx-child into the given fusion path instead of beeing included into the content. This allows to render AFX children into different props and to assign Fusion-prototypes to props.

Is transpiled as:

Meta-Attributes

In general all meta-attributes start with an @-sign.

The @path-attribute can be used to render a child node directly into the given path below the parent Fusion:Object instead of beeing included into the content property.

The @children-attribute defined the property that is used to render the content/children of the current tag into. The default property name for the children is content.

The @key-attribute can be used to define the property name of an item among its siblings if an array is rendered. If no @key is defined index_x is used starting at `x=1.

Attention: @path, @children and @key only support string-values and no expressions.

All other meta attributes are directly added to the generated prototype and can be used for @if or @process statements.

Whitespace and Newlines

AFX is not html and makes some simplifications to the code to optimize the generated fusion and allow a structured notation of the component hierarchy.

The following rules are applied for that:

  1. Newlines and Whitespace-Characters inside a text literal collapse to a single space.

Is transpiled as:

  1. Newlines and Whitespace-Characters that are connected to a newline are considered irrelevant and are ignored

Is transpiled as:

  1. Spaces between Elements on a single line are considered meaningful and are preserved

Is transpiled as:

HTML Comments

AFX accepts html comments but they are not transpiled to any fusion. However if you are converting html to afx it is allowed to have comments inside and you can use comments for disabeling parts of your afx during testing.

Is transpiled as:

Examples

Rendering of Collections with Neos.Fusion:Collection

For rendering of lists or menus a presentational-component usually will recieve arrays of preprocessed data as prop. To iterate over such an array the Neos.Fusion:Collection can be used in afx.

Augmentation of Child-Components with Neos.Fusion:Augmenter

The Neos.Fusion:Augmenter can be used to add additional attributes to rendered content. This allows some rendering flexibility without extending the api of the component. This is a useful pattern to avoid unneeded tag-wrapping in cases where only additional classes are needed.

The example iterates over a list of images and uses the Vendor.Site:ImageExample to render each one while the Neos.Fusion:Augmenter adds a class- and data-attribute from outside.

License

see LICENSE file


All versions of fusion-afx with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
neos/fusion Version self.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 neos/fusion-afx contains the following files

Loading the files please wait ....