Instructions to Install and Update Composer Libraries with Strauss for PDF Invoices & Packing Slips for WooCommerce
This guide provides detailed steps to correctly install and update Composer libraries in the PDF Invoices & Packing Slips for WooCommerce plugin using Strauss for class prefixing.
- PHP installed on your system.
- Composer installed on your system.
strauss.phar
file located in the plugin root directory.
-
Install Composer Dependencies
First, ensure all your dependencies are installed using Composer:
composer install
-
Run Strauss to Apply Class Prefixing
Use the Strauss PHAR file to prefix the classes as configured in your
composer.json
:php strauss.phar
-
Do Not Run
composer dump-autoload
After StraussAvoid running
composer dump-autoload
after running Strauss, as it will regenerate the autoload files and potentially undo the prefixing work done by Strauss.
-
Update Composer Dependencies
Use Composer to update your dependencies:
composer update
-
Run Strauss to Apply Class Prefixing
After updating the dependencies, run Strauss again to apply the necessary class prefixing:
php strauss.phar
-
Do Not Run
composer dump-autoload
After StraussSimilar to the installation step, do not run
composer dump-autoload
after running Strauss.
Ensure your composer.json
is configured correctly for Strauss. Below is an example configuration:
{
"name": "wpovernight/woocommerce-pdf-invoices-packing-slips",
"description": "PDF Invoices & Packing Slips for WooCommerce",
"autoload": {
"psr-4": {
"WPO\\IPS\\": "includes/",
"WPO\\IPS\\UBL\\": "ubl/"
},
"classmap": [
"vendor/"
]
},
"require": {
"dompdf/dompdf": "^3.0",
"symfony/polyfill-mbstring": "^1.27",
"symfony/polyfill-iconv": "^1.27",
"sabre/xml": "^2.2.5"
},
"extra": {
"strauss": {
"target_directory": "vendor",
"namespace_prefix": "WPO\\IPS\\Vendor\\",
"classmap_prefix": "WPO_IPS_Vendor_",
"constant_prefix": "WPO_IPS_VENDOR_",
"packages": [],
"update_call_sites": false,
"override_autoload": {},
"exclude_from_copy": {
"packages": [],
"namespaces": [],
"file_patterns": [
"/^psr.*$/"
]
},
"exclude_from_prefix": {
"packages": [
"symfony/polyfill-mbstring",
"symfony/polyfill-iconv",
"masterminds/html5"
],
"namespaces": [],
"file_patterns": []
},
"namespace_replacement_patterns": {},
"delete_vendor_packages": false,
"delete_vendor_files": false
}
},
"config": {
"platform-check": false
}
}