Download the PHP package mohammadraufzahed/folio without Composer
On this page you can find all versions of the php package mohammadraufzahed/folio. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mohammadraufzahed/folio
More information about mohammadraufzahed/folio
Files in mohammadraufzahed/folio
Package folio
Short Description Modern PDF generation library for PHP 8.3+ with composable document model, layout engine, and custom template language
License MIT
Homepage https://mohammadraufzahed.github.io/folio/
Informations about the package folio
Folio PDF
A modern, production-quality PDF generation library for PHP 8.3+.
Flutter / SwiftUI / Jetpack Compose for PDFs.
Folio PDF implements its own document model, layout engine, templating engine, and PDF renderer - no wrapping of HTML-to-PDF solutions. It provides a composable, immutable design with a fluent builder API and a custom template language for declarative PDF generation.
Features
- PHP 8.3+ with strict types everywhere
- Zero Runtime Dependencies - pure PHP implementation
- Composable Document Model - immutable nodes with fluent builder API
- Custom Template Language - declarative syntax with data binding
- Layout Engine - flex and grid layouts with automatic pagination
- Comprehensive Styling - colors, fonts, borders, shadows, spacing
- Table Support - simple, nested, multi-header, and multi-level tables
- Page Chrome - themed headers and footers with page numbers
- Developer Tooling - LSP, VS Code extension, formatter, tree-sitter grammar
Installation
Install via Composer:
Requirements
- PHP 8.3 or higher
- Composer for dependency management
- No external dependencies or extensions required
Quick Start
PHP Builder API
Template Language
Documentation
Full documentation is available at mohammadraufzahed.github.io/folio
- Getting Started - Installation and basic usage
- API Reference - Complete API documentation
- Template Language - Template syntax and features
- Examples - Real-world usage examples
- Tooling - LSP, formatter, and VS Code extension
Architecture
Folio PDF is built with a clean, modular architecture:
- Document Model - Immutable AST nodes (Page, Column, Row, Text, Table, etc.)
- Layout Engine - Flex and grid layout calculations with automatic pagination
- Template Compiler - Lexer, parser, and PHP code generator for templates
- Styling System - Comprehensive style properties with type safety
- PDF Writer - Direct PDF generation without external dependencies
Key Concepts
Immutable Design
All document nodes are immutable. Methods like withStyle() return new instances:
Composable Layouts
Build complex layouts from simple components:
Styling
Apply styles with a fluent API:
Examples
See the examples/ directory for complete working examples:
hello-world.php- Basic PDF generationinvoice.php- Invoice with tables and stylingcompany-report.php- Multi-page document with headers/footerstables.php- Various table configurations
Development
Running Tests
Static Analysis
Code Style
Follow PSR-12 coding standards. Use strict types and type hints throughout.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Report bugs via GitHub Issues
- Submit pull requests for improvements
- Discuss features in GitHub Discussions
Security
For security vulnerabilities, please email [email protected] instead of using public issues. See SECURITY.md for details.
License
MIT License - see LICENSE file for details.
Acknowledgments
- Inspired by Flutter, SwiftUI, and Jetpack Compose design patterns
- Built with modern PHP 8.3+ features
- Community-driven open-source project