Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Akeneo Utils Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation:

    composer require clickandmortar/akeneo-utils-bundle "^7.0"
    

    Ensure your config/bundles.php includes:

    ClickAndMortar\AkeneoUtilsBundle\ClickAndMortarAkeneoUtilsBundle::class => ['all' => true]
    
  2. First Use Case: Run the clear-archives command to clean up old Akeneo export/import archives:

    php bin/console candm:akeneo-utils:clear-archives
    

Implementation Patterns

Common Workflows

  1. Disk Cleanup:

    • Schedule clear-archives via cron (e.g., weekly) to prevent disk bloat:
      0 3 * * 0 php bin/console candm:akeneo-utils:clear-archives --days=30
      
    • Tip: Use --dry-run to preview deletions before executing.
  2. Attribute Optimization:

    • Audit unused options with list-unused-options:
      php bin/console candm:akeneo-utils:list-unused-options --family=electronics --attribute=color
      
    • Integration: Pipe output to a CSV for manual review or automate cleanup via a custom script.
  3. Model Maintenance:

    • Remove orphaned models (no children) with:
      php bin/console candm:akeneo-utils:clear-models-without-children
      
    • Best Practice: Backup your database before running destructive commands.

Extension Points

  • Custom Commands: Extend the bundle by creating your own command class and injecting AkeneoUtilsService:
    use ClickAndMortar\AkeneoUtilsBundle\Service\AkeneoUtilsService;
    
    class MyCustomCommand extends Command {
        protected function execute(InputInterface $input, OutputInterface $output) {
            $this->akeneoUtils->customLogic(); // Hypothetical method
        }
    }
    

Gotchas and Tips

Pitfalls

  1. Version Locking:

    • The bundle is tightly coupled to Akeneo versions (e.g., v7.0.* for Akeneo 7.0.*). Mismatches cause failures.
    • Fix: Pin the exact version in composer.json (e.g., "clickandmortar/akeneo-utils-bundle": "7.0.1").
  2. Destructive Commands:

    • clear-models-without-children permanently deletes models. No undo.
    • Mitigation: Test in a staging environment first or use --dry-run.
  3. Permissions:

    • Commands require Akeneo admin privileges. Non-admin users get access denied.
    • Workaround: Run commands via SSH or grant permissions via Akeneo’s security system.

Debugging

  • Verbose Output: Add -v to commands for debugging:
    php bin/console candm:akeneo-utils:list-unused-options -v
    
  • Logs: Check var/log/akeneo_utils.log for errors (ensure logging is configured in config/packages/akeneo_utils.yaml).

Configuration Quirks

  • No Config File: The bundle has no YAML/config file. All settings are CLI-driven.
  • Custom Paths: Override default archive paths by extending the service:
    # config/services.yaml
    ClickAndMortar\AkeneoUtilsBundle\Service\AkeneoUtilsService:
        arguments:
            $archivePath: '%kernel.project_dir%/custom/archives'
    

Pro Tips

  1. Automate Audits:
    • Combine list-unused-options with a script to auto-remove unused options (use Akeneo’s API or PIM API).
  2. Monitor Disk Usage:
    • Add a health check to your Akeneo dashboard using the clear-archives logic.
  3. Backup First:
    • Always export your PIM data before running cleanup commands:
      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.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle