aivopro / composer
AiVoPro Composer plugin - Enhanced custom installer for plugins/themes with advanced asset management
Installs: 0
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:composer-plugin
pkg:composer/aivopro/composer
Requires
- php: ^8.2
- composer-plugin-api: ^2.0
Requires (Dev)
- composer/composer: ^2.3
- phpcompatibility/php-compatibility: ^9.3
- phpmd/phpmd: ^2.13
- phpstan/phpstan: ^1.8
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.7
This package is not auto-updated.
Last update: 2026-01-21 01:07:15 UTC
README
AiVoPro Composer Plugin - Enhanced custom installer for plugins/themes with advanced asset management.
🚀 Installation
composer require oaranha/aivopro-composer
✨ Features
- 🎯 Custom installer for
aivopro-pluginandaivopro-themepackage types - 📦 Automatic copying of public assets to the webroot
- 🧹 Automatic cleanup of public assets on uninstall
- 🌐 Support for glob patterns
- 🎨 Flexible target path resolution
- 💾 File mapping storage for safe removal
📋 Public Files Configuration
AiVoPro plugins can define public files/directories that should be copied to the webroot during installation. This is configured in the package's composer.json under extra.public.
Basic Syntax
{
"extra": {
"public": [
"path/to/file.js",
"path/to/directory",
{
"source": "source/path",
"target": "target/path"
}
]
}
}
Target Path Resolution
The target path follows "Model A" where target is ALWAYS the final destination path:
| Target Format | Description | Result |
|---|---|---|
"file.js" |
Package dir + target | public/e/{vendor}/{pkg}/file.js |
"/file.js" |
Webroot + target | public/file.js |
"." |
Package dir + source basename | public/e/{vendor}/{pkg}/{basename} |
"/." or "/" |
Webroot + source basename | public/{basename} |
null (omitted) |
Package dir + source basename | public/e/{vendor}/{pkg}/{basename} |
"dir/*" |
Glob: contents copied to target | Contents copied to target directory |
📚 Usage Examples
1️⃣ Legacy String Format (preserves full path)
{
"extra": {
"public": [
"widget/dist/index.html",
"widget/dist/styles.css"
]
}
}
Result:
widget/dist/index.html→public/e/{vendor}/{pkg}/widget/dist/index.htmlwidget/dist/styles.css→public/e/{vendor}/{pkg}/widget/dist/styles.css
2️⃣ Copy to Package Directory (no leading /)
{
"extra": {
"public": [
{
"source": "widget/dist/sdk.js",
"target": "sdk.js"
},
{
"source": "assets",
"target": "static"
}
]
}
}
Result:
widget/dist/sdk.js→public/e/{vendor}/{pkg}/sdk.jsassets/→public/e/{vendor}/{pkg}/static/
3️⃣ Copy to Webroot (leading /)
{
"extra": {
"public": [
{
"source": "widget/dist/sdk.js",
"target": "/sdk.js"
},
{
"source": "assets",
"target": "/static/assets"
}
]
}
}
Result:
widget/dist/sdk.js→public/sdk.jsassets/→public/static/assets/
4️⃣ Using Basename Shortcuts (. and /.)
{
"extra": {
"public": [
{
"source": "widget/dist",
"target": "."
},
{
"source": "widget/dist",
"target": "/."
},
{
"source": "widget/dist"
}
]
}
}
Result:
"."→public/e/{vendor}/{pkg}/dist/(package dir + basename)"/."→public/dist/(webroot + basename)- No target →
public/e/{vendor}/{pkg}/dist/(same as".")
5️⃣ Glob Patterns (copy contents)
{
"extra": {
"public": [
{
"source": "widget/dist/*",
"target": "/assets"
}
]
}
}
Result:
- Contents of
widget/dist/(e.g.,index.html,css/,js/) →public/assets/ - Files become
public/assets/index.html,public/assets/css/..., etc.
⚙️ Environment Variables
| Variable | Description | Default |
|---|---|---|
PUBLIC_DIR |
Custom webroot path | public |
Example:
export PUBLIC_DIR="web" composer install
📦 Package Types
This plugin handles the following package types:
aivopro-plugin- Installed topublic/content/plugins/{vendor}/{package}aivopro-theme- Installed topublic/content/plugins/{vendor}/{package}
You can customize the installation path in your root composer.json:
{
"extra": {
"paths": {
"extensions": "custom/path/to/extensions/"
}
}
}
🔧 Development
Quality Assurance
# Run all checks composer analyse # Individual tools composer phpstan # Static analysis composer phpcs # Code style check composer phpmd # Mess detection composer unit-test # Unit tests # Fix code style issues composer fix
Testing
# Run tests composer unit-test # Generate coverage report composer code-coverage
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
👤 Author
A.Aranha
- Email: aranha@ulbra.edu.br
- GitHub: @OARANHA
Made with ❤️ for the AiVoPro ecosystem