Download the PHP package ubertech-za/asciidoctor-wrapper without Composer
On this page you can find all versions of the php package ubertech-za/asciidoctor-wrapper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ubertech-za/asciidoctor-wrapper
More information about ubertech-za/asciidoctor-wrapper
Files in ubertech-za/asciidoctor-wrapper
Package asciidoctor-wrapper
Short Description PHP wrapper for Asciidoctor with configurable styling and theming support
License MIT
Homepage https://github.com/ubertech-za/asciidoctor-wrapper
Informations about the package asciidoctor-wrapper
AsciiDoctor Wrapper
⚠️ BETA SOFTWARE NOTICE This package is currently in beta and is being prepared for testing in upcoming projects. Please expect possible breaking changes in future releases. We do not recommend using this package in production environments without thorough testing.
A Laravel package that provides a PHP wrapper around AsciiDoctor and AsciiDoctor-PDF with advanced theming, styling, and configuration management.
Overview
This package bridges the gap between PHP applications and the powerful AsciiDoctor ecosystem, providing:
- Configurable AsciiDoctor Integration: Support for both
asciidoctorandasciidoctor-pdfexecutables - Advanced Theming System: Create, extend, and manage themes with JSON configuration
- Style Object Composition: Programmatically build themes using fluent APIs
- Theme Inheritance: Extend built-in AsciiDoctor themes or custom themes
- Laravel Integration: Service providers, facades, and configuration management
- Type Safety: Full PHP 8.2+ type declarations and comprehensive testing
Installation
Install the package via Composer:
Prerequisites
You need to have AsciiDoctor installed on your system:
Alternatively, use Docker:
Laravel Integration
Configuration
Publish the configuration file:
Configure your executables in config/asciidoctor.php:
Environment Variables
Add to your .env file:
Usage
Basic Usage
Using the Wrapper Class Directly
Theme System
Creating Themes with the Theme Builder
Loading Themes from JSON
Create a theme file at resources/asciidoctor/themes/my-theme.json:
Load and use the theme:
Theme Inheritance
Themes can extend other themes:
Built-in themes can also be extended:
Font Management
Custom Fonts Configuration
The package supports custom fonts for PDF generation. Fonts are automatically loaded from the configured fonts directory and made available to asciidoctor-pdf themes.
Setting Up Custom Fonts
-
Configure the fonts directory in
config/asciidoctor.php: -
Add font files to your fonts directory:
- Use fonts in themes - the package automatically generates the font catalog:
Font Catalog Generation
When using custom fonts, the package automatically:
- Scans the
fonts_pathdirectory for TTF files - Generates a proper font catalog in the theme YAML
- Sets the
pdf-fontsdirattribute for asciidoctor-pdf - Maps fonts to appropriate theme elements (base, heading, code)
Example generated theme YAML:
Font Environment Variable
Set the fonts directory via environment variable:
Supported Font Formats
- TTF (TrueType) - Primary supported format
- OTF (OpenType) - Also supported by asciidoctor-pdf
Font Naming Convention
For automatic detection of font variants, use this naming pattern:
FontName-Regular.ttf(normal weight)FontName-Bold.ttf(bold weight)FontName-Italic.ttf(italic style)FontName-BoldItalic.ttf(bold italic)
Supported Output Formats
html/html5- HTML outputdocbook/docbook5- DocBook XMLmanpage- Unix manual pagespdf- PDF documents (requires asciidoctor-pdf)docx- Microsoft Word documents
Advanced Configuration
Custom Attributes
Safe Mode
Style Objects
Color Styles
Font Styles
Element Styles
Testing and Validation
Check Executable Availability
Theme Validation
Artisan Commands
The package doesn't include Artisan commands by default, but you can create your own:
Error Handling
The wrapper returns structured results:
Performance and Caching
Theme Caching
Enable theme caching in your configuration:
Best Practices
- Reuse Theme Objects: Create themes once and reuse them for multiple conversions
- Validate Early: Use
validateTheme()during development to catch issues - Cache Compiled Themes: Enable caching for production environments
- Monitor Resources: AsciiDoctor can be memory-intensive for large documents
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Run tests:
composer test - Commit changes:
git commit -am 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Create a Pull Request
Development Setup
Testing
Run the test suite:
License
This package is open-sourced software licensed under the MIT license.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
- UberTech ZA Team
- All Contributors
This package is inspired by the excellent work of:
- AsciiDoctor Project - The core document processing engine
- AsciiDoctor-PDF - PDF generation capabilities
Support
- Issues: GitHub Issues
- Documentation: Package Documentation
- Discussions: GitHub Discussions
Made by Uber Technologies cc
All versions of asciidoctor-wrapper with dependencies
ext-json Version *