Skip to content

Mux Plugin Console Commands Documentation ​

This document provides comprehensive documentation for all available console commands in the Mux plugin for Craft CMS.

Overview ​

The Mux plugin provides several console commands to help manage Mux assets, cache, and synchronization. All commands are prefixed with php craft mux/ and can be run from your Craft project's root directory.

Available Commands ​

1. Assign Commands (mux/assign) ​

The assign commands help you manage volume and folder assignments for MuxAsset elements.

mux/assign/assign ​

Assigns volumeId and folderId to MuxAsset elements that have null values.

Options:

OptionDescription
--volumeIdThe volume ID to assign to assets with null volumeId
--folderIdThe folder ID to assign to assets with null folderId
--verboseShow verbose output during processing
--forceForce assignment without confirmation prompts
--dryRunShow what would be changed without making actual changes

Aliases:

  • -v for --volumeId
  • -f for --folderId
  • -V for --verbose
  • -F for --force
  • -d for --dryRun

Usage Examples:

bash
# Assign volumeId 1 to all assets with null volumeId
php craft mux/assign/assign --volumeId=1

# Assign folderId 2 to all assets with null folderId
php craft mux/assign/assign --folderId=2

# Assign both volumeId 1 and folderId 2 to assets with null values
php craft mux/assign/assign --volumeId=1 --folderId=2

# Dry run to see what would be changed without making changes
php craft mux/assign/assign --volumeId=1 --folderId=2 --dryRun

# Force assignment without confirmation prompts
php craft mux/assign/assign --volumeId=1 --folderId=2 --force

# Show verbose output during processing
php craft mux/assign/assign --volumeId=1 --folderId=2 --verbose

mux/assign/stats ​

Shows statistics about MuxAsset elements with null volumeId or folderId.

Usage Example:

bash
php craft mux/assign/stats

mux/assign/list ​

Lists all assets that have null volumeId or folderId.

Usage Example:

bash
php craft mux/assign/list

mux/assign/list-volumes-and-folders ​

Lists all volumes and folders with their ID and name.

Usage Example:

bash
php craft mux/assign/list-volumes-and-folders

2. Cache Commands (mux/cache) ​

The cache commands help you manage Mux data cache.

mux/cache/clear ​

Clears cache for a specific asset or all assets.

Options:

OptionDescription
--assetIdThe specific asset ID to clear cache for (optional)
--verboseShow verbose output during processing
--forceForce cache clearing without confirmation

Aliases:

  • -a for --assetId
  • -v for --verbose
  • -f for --force

Usage Examples:

bash
# Clear cache for all assets
php craft mux/cache/clear

# Clear cache for a specific asset
php craft mux/cache/clear --assetId=abc123

# Clear cache for all assets with verbose output
php craft mux/cache/clear --verbose

# Force clear cache without confirmation
php craft mux/cache/clear --force

mux/cache/clear-all ​

Clears cache for all MUX assets.

Options:

OptionDescription
--verboseShow verbose output during processing
--forceForce cache clearing without confirmation

Aliases:

  • -v for --verbose
  • -f for --force

Usage Example:

bash
php craft mux/cache/clear-all --verbose

mux/cache/clear-asset ​

Clears cache for a specific asset.

Options:

OptionDescription
--assetIdThe asset ID to clear cache for
--verboseShow verbose output during processing
--forceForce cache clearing without confirmation

Aliases:

  • -a for --assetId
  • -v for --verbose
  • -f for --force

Usage Example:

bash
php craft mux/cache/clear-asset --assetId=abc123

mux/cache/stats ​

Shows cache statistics for MUX-related cache entries.

Options:

OptionDescription
--verboseShow verbose output with detailed asset information

Aliases:

  • -v for --verbose

Usage Example:

bash
php craft mux/cache/stats --verbose

3. Sync Commands (mux/sync) ​

The sync commands help you synchronize Mux assets.

mux/sync/all ​

Syncs all MUX assets.

Usage Example:

bash
php craft mux/sync/all

General Usage Notes ​

  • All commands should be run from your Craft project's root directory
  • Commands that modify data will ask for confirmation unless the --force flag is used
  • Use --verbose flag to get detailed output about what the command is doing
  • Use --dryRun flag (where available) to preview changes without actually making them
  • Commands return appropriate exit codes for scripting purposes

Error Handling ​

  • Commands will display error messages in red for easy identification
  • Success messages are displayed in green
  • Warning messages are displayed in yellow
  • Informational messages are displayed in cyan

Exit Codes ​

  • 0 (ExitCode::OK) - Command completed successfully
  • 1 (ExitCode::DATAERR) - Data error (e.g., invalid parameters)
  • 2 (ExitCode::UNSPECIFIED_ERROR) - Unspecified error occurred

This documentation covers all available console commands in the Mux plugin. For additional help with any specific command, you can use the --help flag with any command to see its specific usage information.