Download the PHP package err0r/larasub without Composer
On this page you can find all versions of the php package err0r/larasub. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download err0r/larasub
More information about err0r/larasub
Files in err0r/larasub
Package larasub
Short Description Laravel Subscription Package
License MIT
Homepage https://github.com/err0r/larasub
Informations about the package larasub
Laravel Subscription Package (Larasub)
[!IMPORTANT]
This package is currently under development and is not yet ready for production use.
Click the Watch button to stay updated and be notified when the package is ready for deployment!
A powerful and flexible subscription management system for Laravel applications with comprehensive plan versioning support.
✨ Features
Core Subscription Management
- 📦 Multi-tiered subscription plans with versioning
- 🔄 Flexible billing periods (minute/hour/day/week/month/year)
- 💳 Subscribe users with custom dates and pending status
- 🔄 Cancel, resume, and renew subscriptions
- 📈 Comprehensive subscription lifecycle tracking
Advanced Feature System
- 🎯 Feature-based access control (consumable & non-consumable)
- 📊 Usage tracking with configurable limits
- ⏰ Period-based feature resets
- 🔋 Unlimited usage support
- 🔍 Feature usage monitoring and quotas
Plan Versioning & Management
- 📋 Plan versioning for seamless updates
- 🔄 Backward compatibility for existing subscribers
- 📅 Historical pricing and feature tracking
- 🚀 Easy rollback capabilities
- 📊 Version-specific analytics
Developer Experience
- 🧩 Simple trait-based integration
- ⚙️ Configurable tables and models
- 📝 Comprehensive event system
- 🔌 UUID support out of the box
- 🌐 Multi-language support (translatable plans/features)
- 🛠️ Rich builder pattern APIs
Table of Contents
- Installation
- Quick Start
- Migration from v2.x to v3.x
- Core Concepts
- Subscription Management
- Feature Management
- Plan Versioning
- Events & Lifecycle
- API Resources
- Configuration
- Commands
- Testing
- Contributing
Installation
Install via Composer:
Publish configuration:
Run migrations:
Quick Start
1. Setup Your User Model
2. Create Features
3. Create Plans with Versioning
4. Subscribe Users
5. Check Features & Usage
Migration from v2.x to v3.x (Plan Versioning)
If upgrading from v2.x, follow these steps:
1. Backup Your Database
2. Update Package & Run Migration
3. Update Your Code
Before (v2.x):
After (v3.x):
See Changelog
Core Concepts
Plans vs Plan Versions
- Plan: A subscription template (e.g., "Premium Plan")
- Plan Version: A specific iteration with pricing and features (e.g., "Premium Plan v2.0")
- Subscriptions: Always reference a specific plan version
- Versioning Benefits: Update plans without affecting existing subscribers
Feature Types
- Consumable: Trackable usage with limits (e.g., API calls, storage)
- Non-Consumable: Boolean access features (e.g., priority support, advanced tools)
Subscription Lifecycle
- Pending: Created but not yet active (
start_at
is null) - Active: Currently running subscription
- Cancelled: Marked for cancellation (can be immediate or at period end)
- Expired: Past the end date
- Future: Scheduled to start in the future
Subscription Management
Creating Subscriptions
Subscription Status
Subscription Operations
Querying Subscriptions
Feature Management
Checking Feature Access
Tracking Feature Usage
Feature Configuration
Feature Visibility
Control which features are displayed to end users while keeping them functional for internal logic:
API Behavior:
- Hidden features remain fully functional for subscription logic and usage tracking
- Only the display/visibility to end users is affected
Feature Relationships
Plan Versioning
Creating Plan Versions
Working with Versions
Subscription Versioning
Events & Lifecycle
The package dispatches events for subscription lifecycle management:
Available Events
Event Listener Example
Automatic Event Checking
The package includes an automated scheduler that checks and triggers subscription events every minute. You can enable and configure this scheduler in your config/larasub.php
file. The scheduler is disabled by default.
API Resources
Transform your models into JSON responses using the provided resource classes:
Configuration
Publish and customize the configuration file:
Key configuration options:
Commands
The package provides several Artisan commands:
Migration Command
Subscription Monitoring
Development Tools
Testing
Run the test suite:
All versions of larasub with dependencies
illuminate/contracts Version ^10.0||^11.0|^12.0
spatie/laravel-package-tools Version ^1.16
spatie/laravel-translatable Version ^6.8