Download the PHP package artem_c/emmet without Composer
On this page you can find all versions of the php package artem_c/emmet. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download artem_c/emmet
More information about artem_c/emmet
Files in artem_c/emmet
Informations about the package emmet
Description
Emmet implementation for php
Installation
Add
to the require section of your composer.json file.
Interface
Global Usage
Simple Usage
OR
Don't use Emmet in way like
Because it's work like prepared Statement in PDO.
Emmet::__construct() will prepare the html tree.
And Emmet::create() will use this tree.
Best practice to create a table html element is
Detail usage
[operation] [ tag [id] [class] [attributes] [element text node] [multiplication] ] | [ html [multiplication] ] | [ text_node [multiplication] ] [operation]
So we have Operations and Tags, Text Nodes and Html elements.
Overview
Emmet string consists of objects and operations. Objects represent by tag or text node or html.
Tag object starts from a tag name
It can start from any charaсter except '`', '%', '{'. Tag node can has id, class, attributes, text and multiplication.
Text node object starts from '{'. And can has multiplication
Text node cann't has any child. So you cann't use '>' operation to the text node object.
Html object represent by variable or function. It can has a multiplication.
It can has a child object.
Operations
( ) ^ > +
Use "+" operation to add sibling to previous elements
Use ">" operation to add child to previous element
Use "^" operation to climb up on the tree
Use "( )" operations for groupping elements Should to know that next after ")" operation will use the first element in the brackets. Let's see.
Tags
To create a tag you can use any character.
You can add an id to your tag with "#"
You can add a class with "." Use " " to add more than one class
To add any other attribute use "[ ]"
To add a text inside your tag use "{ }"
If you need more than one elements use multiplication by "*"
Text Node
You can create a text node without any tag. And use it like other element with "+" operation. But you cann't add a child element to text node.
Variables
You can use a variables like a value of your id, classes, text nodes, or multiplication in your string with " ` ".
You have a special variable "$". which represent a number of your element. the number of element is 0. But if you use a multiplication for your element it will change.
Or if parent element has an multiplication than the child will have the same multiplication
You can use an object in your variable by '.'
Functions
You can use a function in your emmet string. At first you must add a function.
After this you can call it inside your emmet string by using " % ".
You can pass an arguments in your function
Pass the text as argument
Pass the variable as argument
And you can pass more than one argument
Your function can be a string
You can use a default functions.
For generating HTML code inside your function you can use the static methods of a Node class.
Combine value
You can combine value of your tag or id or class etc... With strings variables and functions.
HTML Node
HTML it is a Node of your html tree, and the value of this node is variable or function. You can add the value of the html node inside tag or another html node or sibling it.
Or you can add another nodes to html node. If you use a variable or your function is a string use '{{value}}' in your string. If you use a callable function use the last arg in your function
Screening
You cat use / for screening. When you need one of the special chars inside your text you should use / before symbol.