Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Cloud Cli Laravel Package

laravel/cloud-cli

Laravel Zero CLI to deploy and manage apps on Laravel Cloud. Authenticate via OAuth, link repos, ship and deploy from the terminal, and manage environments, databases, caches, object storage, and domains, with optional JSON output and shell completions.

View on GitHub
Deep Wiki
Context7

Getting Started

Run cloud auth to authenticate via OAuth (opens browser). Configure your local repo with cloud repo:config to set default application/environment. Deploy immediately with cloud ship (guided) or cloud deploy (existing app). Verify with cloud dashboard to open the Cloud UI.

First use case:

cd ~/my-laravel-app
cloud auth
cloud repo:config
cloud ship

Implementation Patterns

Workflow: CI/CD Integration

  1. Pre-deploy: Use cloud deploy:monitor in CI to track deployment status.
  2. Environment variables: Update secrets via cloud environment:variables set --file=.env.production.
  3. Rollback: List deployments with cloud deployment:list and revert via Cloud UI.

Workflow: Infrastructure as Code

  • Terraform-like workflow: Script cloud application:create + cloud environment:create in a shell script.
  • Example:
    #!/bin/bash
    cloud application:create --name=my-app --region=us-east
    cloud environment:create --app=my-app --name=production
    cloud database-cluster:create --app=my-app --name=prod-db --size=small
    

Workflow: Local Dev Sync

  • Database: Sync local DB with cloud database:open (opens a tunnel).
  • Cache: Attach Redis via cloud cache:create --type=redis --size=small.

Workflow: Billing & Cost Control

  • Audit: Run cloud usage --detailed weekly to track spend.
  • Alert: Script cloud usage --period=previous to compare month-over-month costs.

Workflow: Zero-Downtime Deployments

  1. Create a new environment: cloud environment:create --app=my-app --name=staging.
  2. Deploy to staging: cloud deploy --environment=staging.
  3. Swap traffic via Cloud UI once verified.

Gotchas and Tips

Authentication

  • CI/CD: Use cloud auth:token to generate a machine token (store in secrets).
  • Debug: Clear tokens with rm ~/.config/cloud/config.json.

Repo Configuration

  • Overrides: Pass --app/--environment flags to bypass repo defaults.
  • Multi-repo: Use cloud repo:config in each project root.

Environment Variables

  • Masking: Values are masked in --json output (security).
  • Bulk update: Use --file=.env to import variables.

Deployment Quirks

  • Monitoring: cloud deploy:monitor requires a deployment ID (get via cloud deployment:list).
  • Stuck deployments: Use cloud command:run --command="php artisan down" to debug.

Database Snapshots

  • PITR: Restore via cloud database-restore:create --snapshot=my-snapshot --database=my-db.
  • Cost: Snapshots consume storage; delete old ones with cloud database-snapshot:delete.

Object Storage (Buckets)

  • Keys: Rotate keys with cloud bucket-key:create --bucket=my-bucket --name=new-key.
  • Permissions: Update bucket policies via Cloud UI (CLI lacks granular control).

WebSockets

  • Clusters: Create with cloud websocket-cluster:create --size=small.
  • Apps: Attach via cloud websocket-application:create --cluster=my-cluster.

Background Processes

  • Logs: View with cloud command:run --command="tail -f storage/logs/laravel.log".
  • Cron: Schedule via cloud command:run --command="php artisan schedule:run" --schedule="* * * * *".

Debugging

  • Verbose: Add -v to any command (e.g., cloud deploy -v).
  • API errors: Check ~/.config/cloud/config.json for token expiry.

Extension Points

  • Custom commands: Extend with Laravel Zero’s handle() method in src/Commands/.
  • Hooks: Use cloud command:run to trigger post-deploy scripts (e.g., migrations).

Performance Tips

  • Bulk operations: Use --json for scripting (e.g., cloud environment:list --json > envs.json).
  • Caching: Avoid repeated cloud application:list calls in scripts; cache results.

Common Pitfalls

  1. Forgetting cloud repo:config: Leads to manual --app/--environment flags.
  2. Token expiry: Re-authenticate with cloud auth if commands fail with 401.
  3. Region mismatches: Ensure cloud database-cluster:create uses the same region as your app.
  4. DNS propagation: cloud domain:verify may take time; check Cloud UI for status.

```markdown
---
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/entity-migrator
codraw/doctrine-extra
codraw/aws-tool-kit
codraw/validator
codraw/workflow
codraw/open-api
codraw/cron-job
codraw/process
codraw/log
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony