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

Mailcoach Cli Laravel Package

spatie/mailcoach-cli

Command-line tool for Mailcoach. Log in with your instance URL and API token, then run autogenerated commands for every Mailcoach API endpoint (lists, campaigns, etc.). Includes clear-cache/logout and an AI agent skill for Boost/skills.sh.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Laravel Alignment: The package is designed for Laravel ecosystems (via Boost integration) and leverages Laravel’s dependency injection and command-line patterns. It fits seamlessly into Laravel’s Artisan command structure, reducing friction for TPMs managing Laravel-based email workflows.
  • API-Driven: Built atop Mailcoach’s OpenAPI spec, ensuring consistency with the platform’s API contracts. This minimizes manual API handling and reduces risk of breaking changes.
  • Modularity: Commands are auto-generated from the API spec, allowing for future-proofing as Mailcoach’s API evolves. No hardcoded endpoints limit long-term adaptability.

Integration Feasibility

  • Low-Coupling: The CLI operates as a standalone tool (or dev dependency via Boost), avoiding tight coupling with core application logic. Ideal for teams using Mailcoach for marketing but not as a primary transactional system.
  • Authentication: OAuth2/API token-based auth is straightforward but requires secure storage of credentials (e.g., Laravel’s .env or a secrets manager). Risk of credential leaks if not managed properly.
  • Caching: API spec caching (24h refresh) improves performance but may introduce stale data if Mailcoach’s API changes frequently.

Technical Risk

  • Dependency on Mailcoach API: If Mailcoach’s API spec changes (e.g., deprecated endpoints, rate limits), the CLI may require updates. Monitor Mailcoach’s changelog and API stability.
  • Agent Skill Maturity: The AI agent integration (skills.sh) is experimental (0 stars, no dependents). Risk of instability or limited adoption if relying on AI-driven workflows.
  • Error Handling: CLI errors may not propagate gracefully to Laravel’s logging systems. Custom error handlers may be needed for production use.

Key Questions

  1. Use Case Priority: Is this for developer workflows (e.g., CI/CD, testing) or end-user operations (e.g., marketing teams)? This dictates whether Boost integration or standalone CLI is preferred.
  2. Credential Management: How will API tokens be stored/rotated? Will Laravel’s .env suffice, or is a secrets manager (e.g., HashiCorp Vault) required?
  3. API Rate Limits: Mailcoach’s API may have rate limits. How will the CLI handle throttling (e.g., retries, exponential backoff)?
  4. Testing Strategy: How will CLI commands be tested in CI/CD? Mocking the Mailcoach API may be necessary.
  5. Agent Skill Adoption: If using the AI skill, what agents (e.g., Claude, Copilot) will be supported, and how will errors be debugged?

Integration Approach

Stack Fit

  • Laravel Projects: Native support via laravel/boost (Laravel 13+) simplifies integration. The CLI’s commands align with Laravel’s Artisan conventions, reducing learning curves.
  • Non-Laravel PHP: Can be used as a standalone tool via composer global require, but loses Laravel-specific benefits (e.g., service container integration).
  • Monorepos: If Mailcoach is used across multiple services, consider packaging the CLI as a private Composer package with shared auth logic.

Migration Path

  1. Pilot Phase:
    • Install via Boost in a non-production Laravel environment.
    • Replace manual API calls (e.g., Guzzle HTTP clients) with CLI commands for 1–2 workflows (e.g., campaign creation).
    • Validate auth, error handling, and performance.
  2. Gradual Rollout:
    • Replace high-frequency API calls first (e.g., list operations).
    • Phase out custom scripts using the CLI’s auto-generated commands.
  3. Deprecation:
    • Deprecate old API clients in favor of CLI commands, with a 6–12 month transition period.

Compatibility

  • Laravel Versions: Tested with Laravel 13+. For older versions, use the standalone CLI or backport Boost support.
  • Mailcoach API: Ensure the CLI’s cached API spec matches your Mailcoach instance’s version. Use mailcoach clear-cache to refresh if needed.
  • PHP Version: Requires PHP 8.1+. Check compatibility with your project’s PHP version.

Sequencing

  1. Auth Setup:
    • Generate API tokens in Mailcoach (/account/api-tokens).
    • Store tokens securely (e.g., Laravel’s .env or a secrets manager).
  2. CLI Installation:
    • Add to composer.json (dev dependency) or install globally.
    • Run mailcoach login to configure the instance URL.
  3. Command Adoption:
    • Start with read-only commands (e.g., list-campaigns) to validate data integrity.
    • Gradually introduce write operations (e.g., create-campaign).
  4. Agent Integration (Optional):
    • Configure skills.sh if using AI agents (e.g., Copilot).
    • Document agent-specific commands for non-technical users.

Operational Impact

Maintenance

  • Package Updates: Monitor spatie/mailcoach-cli for updates to the API spec or bug fixes. Use Composer’s update or require to patch.
  • Auth Rotation: Implement a process to rotate API tokens (e.g., via Laravel’s env or a secrets manager). Avoid hardcoding tokens.
  • Cache Management: Clear the API spec cache (mailcoach clear-cache) after Mailcoach API updates or every 24h in high-churn environments.

Support

  • Troubleshooting:
    • Debug CLI issues with mailcoach --verbose or Laravel’s log channels.
    • Common issues: Invalid tokens, rate limits, or API spec mismatches.
  • Documentation:
    • Create internal runbooks for:
      • Auth setup and token rotation.
      • Handling API errors (e.g., 429 rate limits).
      • Agent skill commands for non-developers.
  • Escalation Path: For Mailcoach API issues, engage Spatie’s support or Mailcoach’s team via their channels.

Scaling

  • Performance:
    • CLI commands are synchronous. For bulk operations (e.g., 1000+ campaigns), consider batching or async processing (e.g., Laravel queues).
    • Monitor Mailcoach’s API rate limits and adjust CLI usage accordingly.
  • Concurrency: Avoid running multiple CLI instances simultaneously unless Mailcoach’s API supports it (risk of token revocation or rate limits).
  • Monitoring: Log CLI usage (e.g., command success/failure) via Laravel’s logging or a dedicated monitoring tool.

Failure Modes

Failure Scenario Impact Mitigation
API token revoked/expired All CLI commands fail Implement token rotation; use short-lived tokens.
Mailcoach API downtime CLI commands hang or fail Add retry logic with exponential backoff.
API spec changes CLI commands break Test against staging; clear cache proactively.
Rate limit exceeded Slow performance or failures Implement queueing; monitor usage.
Agent skill instability AI-driven workflows fail Fall back to manual CLI commands.

Ramp-Up

  • Developer Onboarding:
    • Document the CLI’s commands and auth setup in the team’s wiki.
    • Provide a sandbox Mailcoach instance for testing.
  • Non-Technical Users:
    • For agent skills, create a cheat sheet of common commands (e.g., “Create a campaign with this template”).
    • Train users on mailcoach login and token management.
  • Training:
    • Conduct a workshop on:
      • CLI vs. API direct usage trade-offs.
      • Debugging common errors (e.g., auth failures).
      • Agent skill limitations (e.g., no direct database access).
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport