- How do I integrate this package with Stripe or another payment gateway?
- The package is billing-provider agnostic and focuses on subscription management. You’ll need to handle payment processing via your gateway (e.g., Stripe) and sync subscription events (like `PlanSubscribed`) via webhooks to update the package’s subscription status. The package provides events for this purpose, but you’ll need to write custom listeners for your gateway’s webhook logic.
- Can I use this package without implementing feature tracking (e.g., just for plans and subscriptions)?
- Yes, the package is modular. You can use it solely for managing plans, addons, and subscriptions without enabling feature tracking. The feature system is optional, so you can skip it if your SaaS doesn’t require granular entitlement controls.
- Does lacodix/laravel-plans support unlimited features or auto-resets for quotas?
- Yes, the package supports both unlimited features (e.g., no quota) and auto-resets for countable features. For example, you can set a feature to reset monthly or disable it entirely for specific plans. This is useful for managing credits, API calls, or other consumable resources.
- What Laravel versions and PHP requirements does this package support?
- The package is compatible with Laravel 10+ and requires PHP 8.1 or higher. It leverages Laravel’s Eloquent ORM and service container, so ensure your project meets these baseline requirements before installation.
- How do I handle multi-plan subscriptions and usage priority?
- The package allows users to subscribe to multiple plans and lets you define an order for subscriptions. When consuming countable features (e.g., API calls), usage is deducted from plans in the order they were subscribed, ensuring priority-based consumption. This is configurable via the subscription’s metadata or order field.
- Can I translate plan names, descriptions, or feature labels for international users?
- Yes, the package integrates with Spatie’s `laravel-translatable` package to support multi-language translations for plans, addons, and features. You can define translations for each locale and display them dynamically in your frontend or API responses.
- What happens if a user exceeds their feature quota? Does the package handle overages?
- The package enforces quotas strictly—if a user exceeds their limit for a countable feature, further consumption will be blocked until the quota resets (e.g., at the start of a new billing cycle). You’ll need to handle communication (e.g., notifications) about overages separately, possibly via Laravel events or notifications.
- Is there built-in support for testing or mocking subscriptions/features in PHPUnit?
- The package provides Eloquent models and migrations, so you can easily seed test data for plans, subscriptions, and features using Laravel’s testing tools. However, you’ll need to write custom test cases for your specific use cases, such as quota consumption or subscription events, as the package doesn’t include predefined test suites.
- How do I migrate existing subscription data to this package’s schema?
- The package includes migrations for plans, features, subscriptions, and user_plan pivot tables. You’ll need to manually map your existing data (e.g., from custom tables or a CRM) to the new schema. Use Laravel’s `Schema::hasTable()` checks or a data migration tool to ensure a smooth transition without data loss.
- Are there alternatives to this package for SaaS subscription management in Laravel?
- Yes, alternatives include Laravel Cashier (for Stripe/Paddle integration), Spatie’s `laravel-permission` (for role-based access), or custom solutions using Eloquent. However, `lacodix/laravel-plans` stands out for its focus on feature-level entitlement tracking, multi-plan subscriptions, and billing-agnostic design, making it ideal for complex SaaS models.