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
[!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 that provides:
✨ Core Features
- 📦 Subscription Plans with tiered pricing
- 🔄 Flexible billing periods (minute/hour/day/week/month/year)
- 🎯 Feature-based access control
- 📊 Usage tracking and limits
- 🔋 Consumable and non-consumable features
⚡ Key Capabilities
- 💳 Subscribe users to plans with custom periods
- 📈 Track feature usage and quotas
- ⏰ Built-in subscription lifecycle events
- 🔄 Cancel/Resume subscription workflows
- 📅 Period-based feature resets
- 🌐 Multi-language support (translatable plans/features)
- 🔍 Feature usage monitoring
- 🎚️ Customizable usage limits
🛠️ Developer Experience
- 🧩 Simple trait-based integration
- ⚙️ Configurable tables and models
- 📝 Comprehensive event system
- 🔌 UUID support out of the box
Table of Contents
- Installation
- Basic Usage
- Advanced Usage
- Configuration
- Resource Classes
- Testing
- Contributing
- Security Vulnerabilities
- Credits
- License
Installation
You can install the package via composer:
Publish the config file with:
Publish and run the migrations with:
Basic Usage
-
Setup the Subscriber Model
Add theHasSubscription
trait to your model: -
Create a Feature
-
Create a Plan
Create subscription plans using the
PlanBuilder
class. When configuring a plan's features, you can specify:- Feature values and display names
- Consumption mode (consumable vs non-consumable)
- Reset intervals (periodic vs fixed)
- Additional feature properties
-
Create a Subscription
-
Check Subscription Status
- Feature Management
Advanced Usage
-
Subscription Management
-
Subscription Renewal
-
Subscription Status Checks
-
Status Transition Detection
These methods help detect when a subscription's status has just changed:
hasStatusTransitioned()
: Checks if any status transition occurredwasJustActivated()
: Detects activation (start date set)wasJustCancelled()
: Detects cancellation (cancel date set)wasJustResumed()
: Detects resumption (cancel date cleared)wasJustRenewed()
: Detects renewal (renewal ID set)
-
Feature Management
-
Events
The package dispatches events for subscription lifecycle:
SubscriptionEnded
- When a subscription expiresSubscriptionEndingSoon
- When a subscription is ending soon (configurable inlarasub.php
. Default: 7 days)
By default, the package includes a task schedule that runs every minute to check for subscriptions that have ended or are ending soon, and triggers the corresponding events.
You can modify this schedule in thelarasub.php
configuration file.Event Listener Example:
Resource Classes
The package provides several resource classes to transform your models into JSON representations:
FeatureResource
: Transforms a feature model.PlanResource
: Transforms a plan model.PlanFeatureResource
: Transforms a plan feature model.SubscriptionResource
: Transforms a subscription model.SubscriptionFeatureUsageResource
: Transforms a subscription feature usage model.
Testing
TODO
Changelog
TODO
Please see CHANGELOG for more information on what has changed recently.
Contributing
TODO
Please see CONTRIBUTING for details.
Security Vulnerabilities
TODO
Please review our security policy on how to report security vulnerabilities.
Credits
- Faisal
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of larasub with dependencies
illuminate/contracts Version ^10.0||^11.0
spatie/laravel-package-tools Version ^1.16
spatie/laravel-translatable Version ^6.8