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

Laravel Plans Laravel Package

lacodix/laravel-plans

Laravel package to manage SaaS plans, addons, subscriptions, and optional features. Supports countable/uncountable features with limits, resets, and consumption across plans, plus translations, ordering, and metadata—billing/invoicing not included.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • SaaS Alignment: The package is purpose-built for Laravel-based SaaS applications, aligning with common billing, subscription, and feature management needs. It abstracts core subscription logic (plans, add-ons, features) while allowing customization via Laravel’s Eloquent and service container.
  • Modularity: Leverages Laravel’s service provider pattern, enabling selective adoption (e.g., plans without features). This reduces coupling with existing billing systems (e.g., Stripe, PayPal) if integrated via webhooks.
  • Extensibility: Supports both countable (e.g., API calls) and uncountable (e.g., premium support) features, accommodating tiered pricing models. Custom feature logic can be injected via events/observers.

Integration Feasibility

  • Laravel Ecosystem: Native integration with Laravel’s Eloquent ORM, Blade, and service container minimizes friction. Compatible with Laravel 10+ (as of last release).
  • Database Schema: Provides migrations for plans, features, subscriptions, and user_plan pivot tables. Assumes a relational database (MySQL/PostgreSQL), but schema can be adapted for other DBs.
  • Webhook Support: Designed to work alongside payment gateways (e.g., Stripe) via events (PlanSubscribed, SubscriptionCancelled). Requires minimal customization for gateway-specific logic.

Technical Risk

  • Gateway Dependency: While the package handles subscription management, it assumes external gateways for payment processing. Misalignment with gateway webhooks (e.g., Stripe vs. custom) could require significant customization.
  • Feature Granularity: Over-engineering risk if the SaaS doesn’t need fine-grained feature tracking (e.g., uncountable features may add unnecessary complexity).
  • Testing Overhead: Limited test coverage in the package (per GitHub actions) may require additional QA for edge cases (e.g., concurrent subscriptions, feature limits).

Key Questions

  1. Billing Integration:

    • How will this package interact with the existing payment gateway (e.g., Stripe, custom)? Are webhook handlers already in place?
    • Does the SaaS require multi-gateway support, or is a single provider sufficient?
  2. Feature Management:

    • Are features a core requirement, or can the package be used solely for plan/subscription management?
    • How will feature usage (e.g., API calls) be tracked and billed (e.g., real-time vs. batch)?
  3. Data Migration:

    • What’s the current subscription/plan data model? How will existing data be migrated to the package’s schema?
    • Are there legacy systems (e.g., CRM) that need to sync with this package?
  4. Scaling:

    • How will subscription events (e.g., renewals, cancellations) scale under high load? Are there plans for queue-based processing?
    • What’s the expected volume of concurrent subscriptions (e.g., 10K vs. 100K users)?
  5. Customization:

    • Are there plans to extend the package (e.g., custom validation, pricing rules)? How will this be maintained?
    • Does the package’s MIT license align with the SaaS’s open-source policy?

Integration Approach

Stack Fit

  • Laravel Compatibility: Fully compatible with Laravel 10+ (PHP 8.1+). No conflicts with common packages (e.g., Laravel Cashier, Spatie’s Laravel-Permission) if used for distinct purposes.
  • Database: Optimized for MySQL/PostgreSQL. Schema migrations are provided, but customizations may be needed for other databases (e.g., SQLite).
  • Frontend: Works with Blade templates for plan display. API-first SaaS can use Laravel’s built-in API resources or custom controllers.

Migration Path

  1. Assessment Phase:
    • Audit current subscription/plan logic (e.g., custom tables, business logic).
    • Map existing features to the package’s countable/uncountable model.
  2. Pilot Integration:
    • Install the package via Composer and publish migrations.
    • Seed initial plans/features via Laravel’s seeder or Tinker.
    • Implement a single plan type (e.g., monthly) to validate core functionality.
  3. Gateway Sync:
    • Configure webhook listeners for the payment gateway (e.g., Stripe) to update subscription statuses in the package.
    • Test edge cases (e.g., failed payments, prorations).
  4. Feature Rollout:
    • Gradually enable features (e.g., API limits, premium support) and validate tracking.
    • Replace custom logic with package events (e.g., FeatureUsed) where applicable.

Compatibility

  • Laravel Packages:
    • Conflict Risk: Low with most packages, but avoid mixing with other subscription packages (e.g., Laravel Cashier). Use Cashier for Stripe integration and this package for feature management if needed.
    • Dependency: Requires Laravel’s auth and database components. No hard dependencies on other packages.
  • Custom Code:
    • Existing plan/subscription logic can be incrementally replaced. Use facade aliases or service bindings to manage transitions.

Sequencing

  1. Phase 1: Core Subscription Management
    • Replace custom plan tables with the package’s plans and subscriptions.
    • Migrate historical data and validate CRUD operations.
  2. Phase 2: Feature Integration
    • Implement feature tracking (countable/uncountable) and tie to user roles/permissions.
    • Build middleware to gate access (e.g., PremiumFeatureMiddleware).
  3. Phase 3: Billing Sync
    • Connect webhooks to update subscription statuses and trigger events (e.g., SubscriptionExpired).
    • Add logic for prorations or add-ons.
  4. Phase 4: Analytics & Reporting
    • Extend the package or build custom reports using the stored data (e.g., MRR, churn).

Operational Impact

Maintenance

  • Package Updates:
    • Monitor lacodix/laravel-plans for breaking changes (MIT license allows forks if needed).
    • Test updates against a staging environment with realistic data volumes.
  • Custom Extensions:
    • Document any custom logic (e.g., feature validation rules) to streamline future updates.
    • Use Laravel’s package events to hook into core functionality without forking.

Support

  • Troubleshooting:
    • Leverage the documentation and GitHub issues for common problems.
    • Debugging tip: Enable Laravel’s query log to inspect package-generated SQL.
  • Vendor Lock-in:
    • Low risk due to MIT license and Laravel’s modularity. Critical logic (e.g., billing) can be abstracted behind interfaces.

Scaling

  • Performance:
    • Subscriptions: Use database indexes on subscriptions.user_id and subscriptions.status for fast lookups.
    • Features: For high-traffic features (e.g., API calls), consider caching feature usage counts (e.g., Redis) to reduce DB load.
    • Events: Offload subscription events to Laravel queues (e.g., PlanSubscribed) to avoid blocking requests.
  • Database:
    • Monitor user_plan pivot table growth. Archive old subscriptions if retention policies allow.
    • Consider read replicas for analytics queries.

Failure Modes

  • Data Corruption:
    • Risk: Race conditions during subscription updates (e.g., concurrent webhook processing).
    • Mitigation: Use Laravel’s database transactions for critical operations (e.g., subscription creation).
  • Billing Sync Issues:
    • Risk: Webhook failures leading to stale subscription states.
    • Mitigation: Implement retry logic (e.g., Laravel Horizon) and manual reconciliation tools.
  • Feature Access:
    • Risk: Incorrect feature permissions due to misconfigured middleware.
    • Mitigation: Unit test feature gates and use Laravel’s authorize() method for clarity.

Ramp-Up

  • Team Onboarding:
    • Developers: 1–2 days to understand core concepts (plans, features, events). Focus on the documentation and package source.
    • QA: 3–5 days to validate edge cases (e.g., plan changes mid-cycle, feature limits).
  • Training Materials:
    • Create internal docs with:
      • Package architecture diagrams.
      • Example workflows (e.g., "How to add a new plan").
      • Common pitfalls (e.g., forgetting to update webhook signatures).
  • Phased Rollout:
    • Start with a non-critical user segment (e.g., beta testers) to validate the integration before full release.
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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle