Download the PHP package eftec/bladeonehtml without Composer

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

BladeOneHtml

It is a PHP library that allows to create forms (view) easily, cleanly and without killing the performance. It uses the library BladeOne to renders the view. This library only uses a single dependency, one file and nothing more.

This library works in two ways:

Packagist Total Downloads [Maintenance]() [composer]() [php]() [php]() [php]() [CocoaPods]()

Usage

  1. This library requires eftec/bladeone. You could install via Composer in the root folder of your project as

composer require eftec/bladeonehtml

  1. And you should extend the class as follows (BladeOneHtml is a Trait)

  2. Create a folders called 📁 "\views" and 📁 "\compiles"
  3. Inside views, creates the next file 📄 "\views\exampleview.blade.php"

$blade=new myBlade();

Template basic

This library adds a new set of tags for the template. The tags uses named arguments, so it is easily configurable.

@<tag>(argument1="value" argument2='value' argument3=value argument4=$variable argument5=function(), argument6="aaa $aaa")

This library uses the native html arguments but some arguments are special

Argument Description example
text It adds a content between the tags. The inner value is always un-quoted. @tag(text="hello") -> <tag>hello</tag>
pre It adds a content before the tag @tag(pre="hello") -> hello<tag></tag>
post It adds a content after the tag @tag(post="hello") -> <tag></tag>hello
between It adds a content between the tags (it works similar than text) @tag(between="hello") -> <tag>hello</tag>
value Usually it works as the normal "value" of html but it also could works differently (in @textarea works like text) @tag(value="hello") -> < tag value="hello"></tag>
values Some components needs a list of object/arrays. This argument is used to sets the list of values @tag(values=$countries)
alias Some components needs or use a list of object/array. This argument is to reference any row inside the list. If values is set and alias is missing, then it creates a new alias called values+"Row". @tag($values=$countries alias=$country)
@tag($values=$countries ) it asumes alias=$countriesRow
optgroup The tag @select could list grouped elements. This argument is used to set the grouping @tag($values=$countries alias=$country @optgroup=$country->continent)

Let's say the next example

It is rendered as

If the tag uses a variable of function, then this view

Is converted into

The method $this->e is used to escape the method.

Note: This library allows any tag, even custom tags (but only if they don't enter in conflict with the special tags, see table)

@input(value="hello world" type="text" mycustomtag="hi" )

Is converted into `

Template usage

input

It shows an input HTML.

Basic example:

hidden

It generates a hidden field

Basic example:

label

It shows a label html

image

It shows an image

select

It shows a select (dropdown list) html object

Example:

Note 1: @items requires the arguments values in the parent (@select) and the arguments value (the selectable value) and text (the visible value) Note 2: @items requires an id, assigned in the same tag or in the parent tag (in this case, the parent is @select) Note 3: By standard, the argument id must be unique.

item

@item is a utility tag used inside other tags. This behaves depending on of their parent tag. It adds a simple line/row to the parent object.

Example:

It renders

items

@items is a utilitarian tag used inside some tags. This behaves depending on of their parent tag. It adds a multiples lines/rows to the parent object using the tag values

Note: This tag requires some arguments:

  • the parent(or this tag) requires the tag values
  • the parent requires the tag value It indicates the current selection (if any)
  • the parent(or this tag) requires the tag alias If alias is missing then it uses the name of values + "Row", i.e. values=product -> alias= productRow
  • the parent(or this tag) requires the tag id
    • The rendered "id" will be generated using this id+"_"+"id of the row". i.e. id="idproduct" => idproduct_0, idproduct_1
    • Why? It is because the id must be unique (html specs)

Example, if $countries is a list of objects then :

If $countries is a list of arrays then:

Inside the tag items, you could use the next variables

variable (where values is the variable used) Specification
$valuesOptGroup It stores the current optgroup (if any). Example: $productOptGroup
$valuesKey It indicates the current key of the current row. Example: $productKey
$alias (if not alias is set then it uses $valuesRow) The current row of the variable. Example: $productRow

optgroup

It starts an optional group (select)

Example:

Note: this tag must be ended with the tag @endoptgroup

checkbox

It adds a single checkbox

Example:

radio

It adds a single radio button

Example:

textarea

It draws a text area.

Example:

button

It draws a button

Example:

link

It adds a hyperlink

Example:

checkboxes

It shows a list of checkboxes

radios

It shows a list of radio buttons

file

It generates a file input value

Note: it also renders a hidden file with name "name"+"_file" with the original value

ul

It generates an unsorted list

ol

It generates a sorted list

pagination

It generates a pagination. It requires bootstrap3, bootstrap4 or bootstrap5.

You can find an example at examples/examplepagination.php

PHP code

Template

Note: The page is base 1. Note: the argument urlparam is used to build the link (domain.dom/web.php?_page=999)

You can change the name of the buttons prev and next as follows:

table

It renders a table

tablehead

It renders the header of the table (optional). Each cell added inside it, is rendered as "th" HTML tag

tablebody

It renders the body of the table (optional). Each cell added inside the table is rendered as "td" HTML tag

tablefooter

It renders the footer of the table (optional). Each cell added inside it, is rendered as "th" HTML tag

tablerows

It generates a row inside the body

cells

It renders a cell inside the tablehead,tablebody (tablerows) or tablefooter

cssbox

It renders and css added into the box

How to add a new css into the cssbox?

Using the method addCss($css,$name)

$css could be a link or a link tag

$name is optional but it avoids to add duplicates. If we add a new CSS with the same name as a previous one, then it is ignored.

jsbox

It renders all JavaScript links added to the box

How to add a new JavaScript into the cssbox?

Using the method addJs($script,$name)

jscodebox

This code adds the tags < script > automatically.

The argument ready indicates if we want to execute the function when the document is ready.

How to add a new JavaScript code into the jscodebox?

Template Customization

BladeOneHtml allows to modify the tags used and to set a default classes for each class.

You can set a default class and tags for Bootstrap 3/4/5 using the next method (pick only one).

Or you could create your own tags and classes

Set a default class

Set a custom pattern

Where nametag could be as follows

Name Description Example Code
nametag It uses the pattern to use when the tag is used input {{pre}}<input{{inner}} >{{between}}< /input>{{post}}
nametag_empty The system uses this pattern if the content (between/text) is empty or not set (a self close tag). If not set, then the system uses nametag even if the content is empty input_empty {{pre}}< input{{inner}} />{{post}}
nametag_item The system uses this pattern for tags @item and @items select_item < option{{inner}} >{{between}}< /option>
nametag_end It uses this pattern when the tag must be closed form_end < /form>

Pattern-Variables inside the code

variable explanation Escaped (*)
{{pre}} The code before the tag : pre <tag ></tag> no
{{post}} The code after the tag : < tag ></tag> post no
{{inner}} The attributes inside the tag : < tag inside > </tag> yes
{{between}} The content between the tag : < tag >between</tag> By default this value is escaped
but it could be un-escaped
{{id}} The id attribute (it is also included in {{inner}}): < tag id > </tag> yes
{{name}} The name attribute (it is also included in {{inner}}): < tag name > </tag> yes

Example of a normal tag:

Note :(*) What is escaped?. For example the text "", if it escaped, it is displayed as "&lt;hello&gt;"

Custom attribute

It is possible to add a custom attribute that it could be used inside a pattern.

For example, let's add the custom tag called customtag

And in the view

Methods

The library has a lit of methods that they could be used to initialize and configure the library. They are optionals.

useBootstrap5

It sets the patterns and classes to be compatible with bootstrap 4.

if argument is true, then it adds the CSS to the css box from the CDN

Our code

Note: If we want to use the css box, then we need to add to our view the next code

useBootstrap4

It sets the patterns and classes to be compatible with bootstrap 4.

if argument is true, then it adds the CSS to the css box from the CDN

Our code

Note: If we want to use the css box, then we need to add to our view the next code

useBootstrap3

It sets the patterns and classes to be compatible with bootstrap 3.

if argument is true, then it adds the CSS to the css box from the CDN

addCss

It adds a CSS to the css box

addJS

It adds a javascript link to the js box

addJSCode

It adds a javascript code to the js box

Public Fields

It is the list of public fields of the class. The fields are public because for performance purpose (versus to use setter and getters)

$pattern

It stores the list of patterns used by the code

Note: see "Pattern-Variable inside the code" to see the list of pattern-variables

$defaultClass

The default CSS class added to a specific tag.

$customAttr

It adds a custom adds that it could be used together with $this->pattern

The custom attribute always removes the quotes and double quotes, so if our value is "hello" -> hello

Creating a new pattern

It is possible to add a new pattern by extending the PHP class.

1- Adding a new pattern

2- Creating a new method

You could create a new PHP class or trait and extend our class. Inside this new structure, you must add a new method with the next structure

Using a new class

Using a trait (recommended, why? It is because trait are more flexible)

3- Creating a new parent Method (container method)

For creating a parent method, you must push a new value inside $this->htmlItem. You can store whatever you want to.

Our objective is to render PHP code, not to evaluate a code. For example, if $args['somearg']=$variable, then our value is $variable (as text), no matter the real value of the variable.

You must also create a method to end the container, and we must also add a new pattern.

Our items could know if they are inside a tag with the next operation

4- Advanced

We could create a component that requires CSS and JavaScript.

For example a date picker.

Note: It's better to add the library of jQuery and date picker once in our code

Version history


All versions of bladeonehtml with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-json Version *
eftec/bladeone Version ^4.12
eftec/messagecontainer Version ^2.8
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 eftec/bladeonehtml contains the following files

Loading the files please wait ....