Vendor Management Class
The Vendor class is the central orchestrator for third-party libraries within GeniXCMS. It primarily manages the integration of Composer-based packages and legacy non-PSR libraries, ensuring that external dependencies are available, secured, and properly mapped to both internal paths and public URLs.
🛠️ Library Initialization
Vendor::autoload()
This method manually triggers the inclusion of the main Composer autoload.php. It is called internally by the system kernel to prepare the environment for third-party classes.
// Typically called once during system boot
Vendor::autoload();
📂 Manual Loading (Non-Composer)
Vendor::loadonce(string $library_path)
For libraries that do not support PSR-4 autoloading or aren't managed via Composer's main manifest, use loadonce() to include them safely from the inc/lib/Vendor/ directory.
// Example: Manually loading a specific library component
Vendor::loadonce('tcpdf/tcpdf.php');
🔗 Path & URL Resolution
Managing assets from vendor packages requires consistent URL and path generation.
| Method |
Return Value |
Common Use Case |
Vendor::url() |
string |
Including vendor CSS/JS in themes or modules (e.g., Bootstrap, FontAwesome). |
Vendor::path() |
string |
Reading library configuration files or checking for file existence on the server. |
📦 Integrated Core Libraries
GeniXCMS comes pre-packaged with several industry-standard libraries managed through the Vendor layer:
🛡️ Security & Content
- HTMLPurifier: The gold standard for sanitizing user-generated HTML and preventing XSS.
- Latte: The primary templating engine featuring automated contextual escaping.
- Summernote: Lightweight WYSIWYG editor for the content dashboard.
📧 Communication & Media
- PHPMailer: Enterprise-grade email transmission engine.
- Intervention Image: High-level API for dynamic image processing, cropping, and WebP conversion.
- GuzzleHttp: Robust HTTP client for handling remote API requests.
lightbulbTipExtending Vendors: If you are adding a new library via Composer, make sure to run composer update in the inc/lib/ directory to update the vendor autoloader, then call Vendor::autoload() within your module or theme logic.
See Also
- Security Class — How vendors like HTMLPurifier are used for data sanitization.
- Vite Helper — Managing modern frontend assets alongside legacy vendor libraries.