spatie/flare-cli
Command-line tool for Flare that lets you authenticate with an API token and interact with the Flare API from your terminal. Manage projects and teams, list and inspect errors and occurrences, resolve or snooze issues, and query monitoring summaries and aggregations.
Installation:
composer global require spatie/flare-cli
Ensure the global bin directory is in your PATH (verify with composer global config bin-dir --absolute).
Authenticate:
flare login
Paste your Flare API token (obtained from flareapp.io/settings/api-tokens).
First Use Case: List recent errors in your project:
flare errors
Or fetch a specific error by ID:
flare error:show 123
Error Triage:
# List recent errors (last 24h)
flare errors --days=1
# Filter by project
flare errors --project=my-project-name
# Show full error details
flare error:show <ID> --with-trace
Performance Monitoring:
# List slowest requests
flare requests --slowest
# Compare request durations
flare requests --compare=1h
Automated Reporting:
# Export errors to JSON (for CI/CD pipelines)
flare errors --export=errors.json
# Slack notification for critical errors
flare errors --critical | xargs -I{} curl -X POST -d "text=New error: {}" <SLACK_WEBHOOK>
Laravel Artisan Hooks:
Add Flare CLI to your post-deploy script in deploy.php (Deployer) or after-deploy in Laravel Forge:
flare errors --critical --days=1 | mail -s "Critical Errors" devs@example.com
CI/CD Pipelines: Use in GitHub Actions to block deployments on critical errors:
- name: Check Flare Errors
run: |
ERRORS=$(flare errors --critical --days=1 --count)
if [ "$ERRORS" -gt 0 ]; then
echo "Critical errors found: $ERRORS"
exit 1
fi
Local Development:
Alias frequent commands in your ~/.bashrc or ~/.zshrc:
alias flare-latest="flare errors --days=1 --limit=5"
alias flare-slow="flare requests --slowest --limit=3"
Token Management:
flare logout) on shared machines can expose your API token.flare logout explicitly or set a short token expiry in Flare’s settings.Rate Limiting:
flare errors --poll) may hit Flare’s API limits.--limit to cap results:
flare errors --days=7 --limit=100
Project Context:
flare errors without specifying a project may return data from all projects.--project or set a default in your ~/.flare-cli/config.json:
{
"default_project": "my-project-name"
}
Trace Depth:
--with-trace and pipe to a pager:
flare error:show 123 --with-trace | less
Silent Failures: If commands hang or return no data, verify:
flare whoami).flare projects).flare ping).JSON Output:
For debugging, use --json to inspect raw API responses:
flare errors --json | jq '.data[0].trace'
Custom Commands:
Extend functionality by wrapping Flare CLI in a custom script. Example (flare-custom.sh):
#!/bin/bash
ERRORS=$(flare errors --critical --days=1 --count)
if [ "$ERRORS" -gt 0 ]; then
flare errors --critical --export=critical_errors.json
echo "Exported $ERRORS critical errors to critical_errors.json"
fi
Webhook Integration: Use Flare’s webhook API alongside CLI to trigger actions:
# Fetch webhook payloads
flare webhooks --limit=5
Configuration:
Override defaults via ~/.flare-cli/config.json:
{
"days": 7,
"limit": 50,
"with_trace": true
}
Now flare errors will use these defaults.
alias flare-critical="flare errors --critical --days=1 --with-trace"
fzf:
Fuzzy-search errors interactively:
flare errors --json | jq -r '.data[] | "\(.id): \(.message)"' | fzf | awk '{print $1}' | xargs flare error:show
flare errors --tag=deploy:abc123
How can I help you explore Laravel packages today?