clickandmortar/akeneo-utils-bundle
Symfony bundle for Akeneo that adds handy utility commands: clear old archives, list unused attribute options, remove empty product models, and delete attributes while purging values without touching product modification dates.
Installation:
composer require clickandmortar/akeneo-utils-bundle "^7.0"
Ensure your config/bundles.php includes:
ClickAndMortar\AkeneoUtilsBundle\ClickAndMortarAkeneoUtilsBundle::class => ['all' => true]
First Use Case:
Run the clear-archives command to clean up old Akeneo export/import archives:
php bin/console candm:akeneo-utils:clear-archives
Disk Cleanup:
clear-archives via cron (e.g., weekly) to prevent disk bloat:
0 3 * * 0 php bin/console candm:akeneo-utils:clear-archives --days=30
--dry-run to preview deletions before executing.Attribute Optimization:
list-unused-options:
php bin/console candm:akeneo-utils:list-unused-options --family=electronics --attribute=color
Model Maintenance:
php bin/console candm:akeneo-utils:clear-models-without-children
AkeneoUtilsService:
use ClickAndMortar\AkeneoUtilsBundle\Service\AkeneoUtilsService;
class MyCustomCommand extends Command {
protected function execute(InputInterface $input, OutputInterface $output) {
$this->akeneoUtils->customLogic(); // Hypothetical method
}
}
Version Locking:
v7.0.* for Akeneo 7.0.*). Mismatches cause failures.composer.json (e.g., "clickandmortar/akeneo-utils-bundle": "7.0.1").Destructive Commands:
clear-models-without-children permanently deletes models. No undo.--dry-run.Permissions:
-v to commands for debugging:
php bin/console candm:akeneo-utils:list-unused-options -v
var/log/akeneo_utils.log for errors (ensure logging is configured in config/packages/akeneo_utils.yaml).# config/services.yaml
ClickAndMortar\AkeneoUtilsBundle\Service\AkeneoUtilsService:
arguments:
$archivePath: '%kernel.project_dir%/custom/archives'
list-unused-options with a script to auto-remove unused options (use Akeneo’s API or PIM API).clear-archives logic.php bin/console akeneo:export:data --format=json --output-dir=/backups
```markdown
## Extension Points (Bonus)
- **Event Listeners**: Hook into Akeneo’s `akeneo_pim_enrich_attribute_option_create` event to auto-cleanup unused options.
- **Custom Metrics**: Extend the bundle to add disk-usage metrics to Akeneo’s admin panel.
How can I help you explore Laravel packages today?