CLI Overview
Swarm Icons ships with a command-line tool that handles icon set management without requiring Node.js. It speaks directly to the npm registry and the Iconify API in pure PHP, so you can browse, download, search, update, and export icons from your terminal.
Running the CLI
Section titled “Running the CLI”The CLI is installed automatically with Composer. Run it from your project root:
php vendor/bin/swarm-iconsThis shows the full list of available commands. To get help for any command, add --help:
php vendor/bin/swarm-icons json:download --helpAvailable commands
Section titled “Available commands”| Command | Description |
|---|---|
json:browse | Browse all 200+ Iconify icon sets with filtering |
json:download | Download JSON icon collections from npm |
json:update | Check for and apply updates to downloaded sets |
icon:search | Search icons by name across sets |
icon:list | List all icons in a local directory or Iconify set |
icon:export | Export icons from a JSON collection as standalone SVG files |
cache:clear | Clear the icon cache |
cache:warm | Pre-fetch icons into the cache for production |
init | Generate a starter configuration file |
Typical workflow
Section titled “Typical workflow”A common workflow when starting a new project:
# 1. Browse what's availablephp vendor/bin/swarm-icons json:browse --search=material
# 2. Download the sets you needphp vendor/bin/swarm-icons json:download mdi tabler heroicons
# 3. Search for specific iconsphp vendor/bin/swarm-icons icon:search tabler arrow
# 4. Later, check for updatesphp vendor/bin/swarm-icons json:update --dry-runThe manifest
Section titled “The manifest”Downloads are tracked in a swarm-icons.json file at your project root. This manifest records both the set prefixes and their npm versions, enabling two features:
- Restore after a fresh clone: running
php vendor/bin/swarm-icons json:downloadwith no arguments re-downloads everything in the manifest. - Update detection:
json:updatecompares stored versions against npm to find newer releases.
You can automate restoration by adding a Composer script:
"scripts": { "post-install-cmd": ["swarm-icons json:download"], "post-update-cmd": ["swarm-icons json:download"]}What’s next
Section titled “What’s next”- Icon Set Commands: browse, download, and search icon sets
- Updating Sets: keep your downloaded sets current
- Exporting Icons: extract standalone SVG files for designers
- Cache & Utilities: cache management, icon listing, and project setup