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

Whop Symfony Bundle Laravel Package

devmatchable/whop-symfony-bundle

Symfony 7 bundle for the Whop PHP SDK. Autowires WhopApiClient and WebhookVerifier from config, provides a ready-to-use (overridable) webhook controller/route, and supports sandbox base URL and custom HTTP client selection.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Symfony 7 Alignment: The bundle is tightly coupled to Symfony 7, leveraging modern features like #[AsEventListener] and #[AsDecorator]. This ensures compatibility with Symfony’s latest conventions (e.g., no XML routes, PSR-18 HTTP clients).
  • Modularity: The separation of concerns between the SDK (core logic) and the bundle (framework integration) aligns with Symfony’s modular design. The bundle’s role is limited to wiring, configuration, and webhook handling, avoiding duplication with the SDK.
  • Event-Driven Design: The WhopWebhookReceivedEvent enables decoupled, reactive handling of webhooks, fitting Symfony’s event system. This is ideal for scalable, maintainable architectures.

Integration Feasibility

  • Low Friction: The bundle’s Flex recipe automates configuration, routes, and environment variables, reducing setup complexity. Manual setup is straightforward for non-Flex projects.
  • PSR Compliance: The bundle adheres to PSR-18 (HTTP client) and PSR-17 (factories), ensuring compatibility with modern PHP ecosystems.
  • Webhook Verification: Built-in signature verification (WebhookVerifier) simplifies secure webhook handling, reducing boilerplate for developers.

Technical Risk

  • Pre-Stable State: The package is in active development (pre-1.0.0), introducing API instability risk. Breaking changes are likely before stabilization.
  • Dependency on SDK: The bundle depends on devmatchable/whop-php-sdk, which is not yet on Packagist. This requires manual VCS repository configuration, adding friction for adoption.
  • Limited Adoption: With 0 stars and no production use cases, the bundle’s long-term viability is unproven. Lack of community feedback or maintenance history is a risk.
  • Symfony 7 Only: The bundle’s strict Symfony 7 requirement may limit adoption in projects using older versions or other frameworks.

Key Questions

  1. Stability: When is the next stable release (1.0.0) expected, and what is the deprecation policy for pre-stable changes?
  2. SDK Maturity: Is the underlying whop-php-sdk production-ready, or does it share the same pre-stable risks?
  3. Customization Limits: How flexible is the webhook handler override mechanism for edge cases (e.g., custom signature validation, non-standard payloads)?
  4. Performance: Are there performance implications of using the bundle’s default event-driven approach for high-throughput webhook processing?
  5. Testing: What is the coverage of integration tests for the bundle’s core functionality (e.g., webhook verification, API client wiring)?
  6. Monitoring: Does the bundle provide observability hooks (e.g., logging, metrics) for webhook processing or API calls?
  7. Migration Path: How would a project migrate from a custom webhook implementation to this bundle without downtime?

Integration Approach

Stack Fit

  • Symfony 7 Projects: Ideal for greenfield or existing Symfony 7 applications requiring Whop integration. The bundle’s design aligns with Symfony’s service container, event system, and routing.
  • PHP 8.4+: Requires PHP 8.4+, which may necessitate upgrades for projects on older versions.
  • PSR-18 HTTP Clients: Works seamlessly with Symfony’s built-in HTTP client or custom PSR-18 clients (e.g., Guzzle, Symfony’s HttpClient).
  • Event-Driven Architectures: Best suited for applications already using Symfony’s event system (e.g., for webhook handling, logging, or analytics).

Migration Path

  1. Assessment Phase:
    • Audit existing Whop integrations (custom SDK usage, webhook handlers, API clients).
    • Identify gaps (e.g., custom DTOs, signature validation logic) that may not be covered by the bundle.
  2. Pilot Integration:
    • Install the bundle in a non-production environment (composer require devmatchable/whop-symfony-bundle).
    • Configure whop.yaml and test the autowired WhopApiClient and webhook endpoint.
    • Override the default webhook handler if custom logic is required.
  3. Incremental Replacement:
    • Replace custom API client instantiation with the autowired service.
    • Migrate webhook routes to the bundle’s endpoint (/_whop/webhook by default).
    • Subscribe to WhopWebhookReceivedEvent for existing webhook logic.
  4. Validation:
    • Test webhook signature verification, payload decoding, and event dispatching.
    • Verify API client functionality (e.g., payments, subscriptions) matches existing behavior.
  5. Rollout:
    • Deploy to staging, monitor for issues (e.g., signature failures, missing payloads).
    • Gradually replace remaining custom logic (e.g., decorate the handler for transitional logic).

Compatibility

  • Symfony Versions: Only compatible with Symfony 7. Projects using Symfony 6 or earlier will need alternative solutions (e.g., manual SDK integration).
  • PHP Versions: Requires PHP 8.4+. Projects on PHP 8.1–8.3 will need upgrades.
  • Whop SDK: Directly depends on devmatchable/whop-php-sdk. Ensure the SDK’s API aligns with your use case (e.g., DTOs, webhook events).
  • Existing Webhooks: If using a custom webhook endpoint, update Whop’s webhook configuration to point to the bundle’s path (/_whop/webhook or custom path).

Sequencing

  1. Configuration:
    • Add whop.yaml to config/packages/ (or use Flex recipe).
    • Set environment variables (WHOP_API_KEY, WHOP_WEBHOOK_SECRET).
  2. Service Wiring:
    • Replace manual WhopApiClient instantiation with type-hinted autowiring.
  3. Webhook Route:
    • Import the bundle’s route in config/routes/whop.yaml.
    • Update Whop’s webhook URL to the new endpoint.
  4. Event Listeners:
    • Replace custom webhook handlers with #[AsEventListener] subscribers for WhopWebhookReceivedEvent.
  5. Custom Logic:
    • Override the default handler if needed (e.g., implement WhopWebhookHandlerInterface or extend EventDispatchingWebhookHandler).
  6. Testing:
    • Validate API calls, webhook verification, and event dispatching in isolation and integration tests.

Operational Impact

Maintenance

  • Bundle Updates: Monitor for breaking changes in pre-stable releases. Test updates thoroughly before production deployment.
  • SDK Dependencies: Stay aligned with the whop-php-sdk roadmap. Major SDK changes may require bundle updates or custom patches.
  • Configuration Drift: Centralize Whop configuration in whop.yaml to avoid scattered environment variables or hardcoded values.
  • Handler Overrides: Document custom handler logic (e.g., in services.yaml) to simplify maintenance and onboarding.

Support

  • Limited Community: With no stars or production use cases, support may rely on the maintainers or community forums. Plan for self-service troubleshooting.
  • Debugging: Leverage Symfony’s built-in tools (e.g., debug:container, debug:event-dispatcher) to inspect services and events.
  • Webhook Failures: Implement logging for WhopWebhookReceivedEvent to track payloads, signatures, and handler outcomes. Example:
    #[AsEventListener]
    public function logWebhook(WhopWebhookReceivedEvent $event): void
    {
        $this->logger->info('Whop webhook received', [
            'payload' => $event->payload,
            'raw' => $event->rawPayload,
        ]);
    }
    
  • API Client Issues: Use Symfony’s HTTP client logging or decorate the WhopApiClient to intercept and log API calls.

Scaling

  • Webhook Throughput: The bundle’s event-driven approach scales horizontally with Symfony’s process/queue workers (e.g., Messenger component). For high volume:
    • Decouple webhook handling with a queue (e.g., #[AsAsync] or Symfony Messenger).
    • Implement rate limiting or batching in custom handlers.
  • API Concurrency: The WhopApiClient uses Symfony’s HTTP client, which supports async requests. For high concurrency:
    • Configure a custom HTTP client with connection pooling (e.g., Guzzle with pool middleware).
    • Implement retry logic for transient failures (e.g., decorate the client).
  • Database Load: Webhook payloads are not persisted by default. For auditing or replayability:
    • Store payloads in a database or message queue (e.g., Doctrine, RabbitMQ) in event listeners.

Failure Modes

Failure Scenario Impact Mitigation
Invalid webhook signature 401 Unauthorized; missed events Ensure WHOP_WEBHOOK_SECRET is correct; log verification failures.
Malformed JSON payload 400 Bad Request; event not dispatched Validate payload structure in custom handlers or listeners.
API key revoked or expired 401 on
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.
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky