Download the PHP package webfiori/php-structs without Composer

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

WebFiori UI Package

PHP Version Latest Version Total Downloads License

A PHP library for creating HTML documents and DOM manipulation with an object-oriented approach. Build dynamic web pages, forms, tables, and complex UI components programmatically with clean, readable code.

✨ Features

📋 Table of Contents

🚀 Installation

Install via Composer:

Or add to your composer.json:

Requirements

⚡ Quick Start

Create Your First HTML Document

Build Elements Programmatically

🧠 Core Concepts

HTMLNode - The Foundation

Every HTML element is represented by an HTMLNode object:

Method Chaining

Most methods return the HTMLNode instance, enabling fluent interfaces:

Parent-Child Relationships

📄 HTML Document Creation

Complete Document Structure

Head Section Management

🔧 Working with Elements

Element Creation and Manipulation

Attribute Management

Text Content and HTML Entities

Element Traversal and Manipulation

📝 Forms and Input

Complete Form Creation

Advanced Input Types

📊 Tables and Data

Dynamic Data Tables

📋 Lists and Navigation

Navigation Menus

Nested Lists

🖼️ Images and Media

Image Galleries and Media Components

🎨 Template System

HTML Templates with Slots

Create reusable HTML templates with placeholder slots:

template.html:

Using the template:

PHP Templates with Logic

Create dynamic templates with PHP logic:

blog-post.php:

Using the PHP template:

🎨 Styling and CSS

CSS Management

Responsive Design

🚀 Advanced Features

Iterator and Countable Interfaces

WebFiori UI implements PHP's Iterator and Countable interfaces for seamless traversal:

XML Document Generation

⚡ Performance Tips

Optimizing HTML Output

Memory Management

Efficient Styling

📚 API Reference

Core Classes

HTMLNode

The foundation class for all HTML elements.

Constructor:

Key Methods:

Method Parameters Return Description
addChild() $node, $attrs = [], $chainOnParent = false HTMLNode Adds a child element
setAttribute() string $name, mixed $val = null HTMLNode Sets an attribute
setAttributes() array $attrs HTMLNode Sets multiple attributes
getAttribute() string $name string\|null Gets attribute value
hasAttribute() string $name bool Checks if attribute exists
removeAttribute() string $name HTMLNode Removes an attribute
setStyle() array $styles, bool $override = false HTMLNode Sets CSS styles
setClassName() string $class, bool $override = true HTMLNode Sets CSS class
applyClass() string $class, bool $override = true HTMLNode Applies CSS class
text() string $text, bool $escEntities = true HTMLNode Sets text content
setText() string $text, bool $escEntities = true HTMLNode Sets text content
getText() - string Gets text content
toHTML() bool $formatted = false, int $initTab = 0 string Generates HTML
toXML() bool $formatted = false string Generates XML

Element Creation Methods:

Method Parameters Return Description
div() array $attrs = [] HTMLNode Creates div element
form() array $attrs = [] HTMLNode Creates form element
input() string $type = 'text', array $attrs = [] HTMLNode Creates input element
table() array $attrs = [] HTMLNode Creates table element
tr() array $data = [], array $attrs = [], bool $headerRow = false HTMLNode Creates table row
ul() array $items = [], array $attrs = [] HTMLNode Creates unordered list
ol() array $items = [], array $attrs = [] HTMLNode Creates ordered list
li() $body, array $attrs = [] HTMLNode Creates list item
img() array $attrs = [] HTMLNode Creates image element
anchor() string\|HTMLNode $body, array $attrs = [] HTMLNode Creates anchor element
paragraph() string\|HTMLNode $body = '', array $attrs = [], bool $escEntities = true HTMLNode Creates paragraph

HTMLDoc

Represents a complete HTML document.

Constructor:

Key Methods:

Method Parameters Return Description
getBody() - HTMLNode Gets the body element
getHeadNode() - HeadNode Gets the head element
setPageTitle() string $title HTMLDoc Sets document title
getPageTitle() - string Gets document title
setLanguage() string $lang HTMLDoc Sets document language
getLanguage() - string Gets document language

HeadNode

Represents the HTML head section.

Key Methods:

Method Parameters Return Description
addCSS() string $href, array $attrs = [] HeadNode Adds CSS file
addJs() string $src, array $attrs = [] HeadNode Adds JavaScript file
addMeta() string $name, string $content, array $attrs = [] HeadNode Adds meta tag
setPageTitle() string $title HeadNode Sets page title

Constants

Constant Value Description
HTMLNode::COMMENT_NODE '#COMMENT' Identifies comment nodes
HTMLNode::TEXT_NODE '#TEXT' Identifies text nodes
HTMLNode::VOID_TAGS array List of void HTML tags

Static Methods

Method Parameters Return Description
HTMLNode::fromFile() string $path, array $vars = [] HTMLNode\|HTMLDoc\|array Creates nodes from template

Interfaces

WebFiori UI implements standard PHP interfaces:

🎯 Examples

Complete Web Page

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

  1. Clone the repository
  2. Install dependencies: composer install
  3. Run tests: composer test
  4. Check code style: composer cs-check

📄 License

This library is licensed under the MIT License. See the LICENSE file for details.


All versions of php-structs with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
webfiori/collections Version 2.0.x
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 webfiori/php-structs contains the following files

Loading the files please wait ....