Download the PHP package maxpertici/markup without Composer
On this page you can find all versions of the php package maxpertici/markup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maxpertici/markup
More information about maxpertici/markup
Files in maxpertici/markup
Package markup
Short Description A flexible system for building and rendering HTML markup structures
License MIT
Informations about the package markup
Markup
📚 Complete Documentation | Getting Started | Markup | MarkupFactory | MarkupSlot | MarkupFinder
A flexible and intuitive PHP library for building HTML markup structures using a fluent, chainable API. Parse existing HTML, modify and manipulate it easily, or create reusable components with slots, manage CSS classes and attributes, and render HTML efficiently.
Introduction
Markup provides a modern, object-oriented approach to handling HTML in PHP. Instead of mixing HTML strings or using complex templating engines, Markup offers:
- ✨ Fluent API - Chain methods for intuitive markup building
- 🎯 Slot System - Named placeholders like Vue.js or Laravel Blade
- 🎨 CSS Class Management - Add, remove, check classes easily
- ⚙️ HTML Attributes - Full control over element attributes
- 🔄 Nested Components - Compose complex structures from simple parts
- 🚀 Dual Rendering -
render()to return string,print()for streaming - 🔁 Conditional & Loop Helpers -
when()andeach()for dynamic content - 🔍 Search & Find - Query your markup tree with CSS selectors
- 📦 Zero Dependencies - Pure PHP, no external requirements
Perfect for building reusable UI components, generating dynamic HTML, or creating a component library for your PHP applications.
Requirements
- PHP 8.1 or higher
Installation
Install via Composer:
Getting Started
Quick Example
Creating Components
Output:
Managing Classes and Attributes
Using Slots
Finding and Manipulating Elements
Conditional and Loops
Nested Lists with MarkupFlow
Use MarkupFlow to create complex nested structures:
Output:
MarkupFlow allows you to group multiple elements that will be rendered sequentially within a parent element, perfect for creating nested structures.
Real-World Example: Web Scraping
Fetch HTML from a URL and extract content:
Use collection methods to filter and transform:
Documentation
For complete documentation, examples, and API reference, visit:
📖 Complete Documentation
Main Sections
- Getting Started - Installation and basic usage
- Markup - Core Markup class with all HTML manipulation methods
- MarkupFactory - Factory methods and HTML parsing
- MarkupQueryBuilder - Fluent interface for searching elements
- MarkupCollection - Collection methods for working with multiple elements
- MarkupFinder - Advanced search and filtering capabilities
- MarkupFlow - Group elements without wrapper
- MarkupSlot - Slot system for reusable components
Key Features
Factory Methods
Create elements quickly with Markup::make() (shortcut for MarkupFactory::create()):
CSS Selector Queries
Find elements using familiar CSS selector syntax:
Collection Methods
Work with multiple elements using powerful collection methods:
Enum-Based Components
Create reusable component libraries with PHP enums:
License
This project is licensed under the MIT License - see the LICENSE file for details.
Credits
Author: Max Pertici
Email: [email protected]
Website: maxpertici.fr
Support
- 📚 Documentation: https://maxpertici.github.io/markup/
- 🐛 Issues: GitHub Issues
- ✉️ Email: [email protected]
Made with ❤️ by Max Pertici