- How do I install Laravel Forge CLI for Laravel projects?
- Run `composer global require laravel/forge-cli` to install globally, or add it to your project’s `composer.json` under `require-dev`. Ensure PHP 8.1+ is installed, as older versions are unsupported. Authenticate with Forge using `forge login` after installation.
- Can I use Forge CLI without Laravel Forge’s paid service?
- No, Forge CLI requires an active Laravel Forge account and API token. The CLI is a companion tool for Forge’s server management features, not a standalone solution. Self-hosted alternatives like Terraform or Ansible would be needed for full independence.
- What Laravel versions does Forge CLI support?
- Forge CLI itself doesn’t enforce Laravel version constraints, but it’s optimized for Laravel 8.x+ projects. The CLI’s PHP 8.1+ requirement aligns with Laravel’s latest LTS support. Older Laravel apps may need PHP upgrades or manual adjustments for compatibility.
- How do I automate deployments in GitHub Actions using Forge CLI?
- Add `forge deploy` to your GitHub Actions workflow, ensuring the `FORGE_API_TOKEN` secret is set. Use environment-specific commands like `forge site:deploy --env=production` and cache SSH keys for faster execution. Example workflows are in Forge’s official docs.
- Does Forge CLI support custom SSH configurations or non-standard ports?
- Yes, use `forge ssh:configure` to specify custom SSH ports, remote users, or key paths. This is useful for servers not managed via Forge’s default provisioning. However, ensure your SSH setup aligns with Forge’s API requirements for full functionality.
- Can I manage SSL certificates or queue workers via Forge CLI?
- Absolutely. Use `forge ssl:create` to generate and install SSL certificates, and `forge queue:workers` to configure and monitor queue workers. These commands mirror Forge’s dashboard features but automate them for scripts or CI/CD pipelines.
- What are the alternatives to Forge CLI for Laravel deployments?
- Alternatives include Capistrano (Ruby-based), Deployer (PHP), or infrastructure-as-code tools like Terraform/Ansible. Forge CLI stands out for Laravel-specific features (e.g., PHP/Nginx stacks) and tight Forge integration, but lacks multi-cloud flexibility compared to Terraform.
- How do I handle environment variables or `.env` files in Forge CLI deployments?
- Use `forge env:pull` to sync `.env` files from Forge to your local or server environment. For CI/CD, pass variables via environment secrets or use `forge env:set` to update them dynamically. Avoid hardcoding sensitive data in scripts.
- Is Forge CLI suitable for production environments with zero-trust security?
- Forge CLI relies on SSH access, which may conflict with zero-trust models. Use `forge ssh:configure` to restrict key access and rotate credentials frequently. Pair it with tools like HashiCorp Vault for secrets management, but test thoroughly in staging first.
- How often is Forge CLI updated, and what’s the maintenance status?
- Forge CLI receives updates every 1–3 months, aligned with Laravel Forge’s roadmap. Check the [GitHub releases](https://github.com/laravel/forge-cli/releases) for changelogs. The package is actively maintained by Laravel’s team, with contributions welcome via GitHub.