- How do I install and use There There CLI in a Laravel project?
- Install globally via `composer global require spatie/there-there-cli`, then authenticate with `there-there login`. For Laravel projects, use Artisan commands (e.g., `shell_exec('there-there list-tickets')`) or wrap CLI calls in a custom service class for cleaner integration. Ensure Composer’s global bin directory is in your `PATH`.
- Can I manage multiple There There workspaces in Laravel?
- Yes. Use profiles to switch workspaces: `there-there login --profile=acme-eu` and `there-there use acme-eu`. Store credentials securely in Laravel’s `.env` or use profile-based CLI switching. This aligns with Laravel’s multi-tenant patterns.
- What Laravel versions does There There CLI support?
- The CLI is PHP-based and works with any Laravel 8+ project. No Laravel-specific dependencies exist, but integration (e.g., wrapping CLI in a service) requires Laravel 8+ for dependency injection and queues. Test with your Laravel version for compatibility.
- How do I handle API tokens securely in Laravel?
- Store tokens in Laravel’s `.env` (e.g., `THERE_THERE_TOKEN=your_token`) and reference them in CLI commands via `--profile` or environment variables. Avoid hardcoding tokens in scripts. For advanced setups, use Laravel Vault or a secrets manager.
- Can I trigger Laravel jobs/queues from There There CLI commands?
- Yes. Use Laravel queues to batch CLI calls (e.g., `there-there list-tickets --page=1` in a delayed job). Dispatch events like `ThereThereTicketProcessed::dispatch()` after CLI actions to decouple workflows. Example: Poll tickets hourly via a scheduled job.
- How do I parse There There CLI JSON outputs into Laravel collections or Eloquent models?
- CLI commands return JSON (e.g., `there-there list-tickets`). Decode outputs with `json_decode(shell_exec('there-there list-tickets'), true)` and map to Laravel collections or Eloquent models. For consistency, create a service class to transform raw JSON into structured data.
- What’s the best way to retry failed CLI commands in Laravel?
- Wrap CLI calls in `try-catch` blocks and log errors via `Log::error()`. For retries, use Laravel queues with exponential backoff (e.g., `dispatch(new RetryThereThereCommand($ticketId))->delay(now()->addMinutes(5))`). Avoid polling aggressively to prevent rate limits.
- Does There There CLI support ticket attachments (e.g., screenshots) in Laravel?
- Yes. Use the `download_url` field from CLI outputs (e.g., `there-there show-ticket --ticket=TICKET_ULID`) to fetch attachments. Store them in Laravel’s storage (e.g., S3) via `Storage::put()`. For automation, create a service to handle downloads and metadata extraction.
- How can I test There There CLI interactions in Laravel?
- Mock `shell_exec()` in unit tests or use a test profile (e.g., `there-there login --profile=test`). For integration tests, set up a test workspace in There There and validate CLI outputs against Laravel models. Use Laravel’s HTTP tests to simulate API responses if needed.
- Are there alternatives to There There CLI for Laravel support automation?
- Alternatives include direct API calls via Guzzle (for full control) or Laravel packages like `spatie/laravel-support-tickets` (if using a database-backed system). There There CLI is ideal for terminal-driven workflows with minimal setup. Compare features like profile management, rate limits, and attachment handling.