Download the PHP package turahe/subscription without Composer
On this page you can find all versions of the php package turahe/subscription. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download turahe/subscription
More information about turahe/subscription
Files in turahe/subscription
Package subscription
Short Description A flexible and feature-rich subscription management system for Laravel applications
License MIT
Informations about the package subscription
Laravel Subscription Package
A flexible and feature-rich subscription management system for Laravel applications. This package provides everything you need to implement subscription-based services, SaaS applications, or any business model that requires recurring billing and plan management.
Features
- Plan Management: Create and manage subscription plans with flexible pricing
- Feature System: Define features with usage limits and resettable periods
- Trial Periods: Built-in trial period support for new subscriptions
- Grace Periods: Configure grace periods for failed payments
- Usage Tracking: Track feature usage with automatic limits enforcement
- Multiple Subscriptions: Support for multiple subscription types per user
- Subscription Lifecycle: Complete subscription lifecycle management (create, renew, cancel, change plans)
- Eloquent Integration: Seamless integration with Laravel's Eloquent ORM
- Soft Deletes: Built-in soft delete support for data integrity
- User Stamps: Automatic tracking of who created/modified records
- Sortable: Built-in sorting capabilities for plans and features
Requirements
- PHP 8.1+
- Laravel 11.x
- MySQL/PostgreSQL/SQLite
Installation
-
Install the package via Composer:
-
Publish the configuration and migration files:
-
Run the migrations:
- Done! The package is now ready to use.
Quick Start
1. Add Subscription Support to Your User Model
2. Create a Plan
3. Subscribe a User
4. Check Subscription Status
Detailed Usage
Plan Management
Creating Plans
Plan Features
Subscription Management
Creating Subscriptions
Changing Plans
Canceling Subscriptions
Renewing Subscriptions
Feature Usage
Checking Feature Availability
Recording Feature Usage
Reducing Feature Usage
Subscription Queries
Active Subscriptions
Subscription Scopes
Configuration
The package configuration is located in config/subscription.php
:
Models
The package includes four main models:
- Plan: Manages subscription plans and their features
- PlanFeature: Defines features available in plans
- PlanSubscription: Handles user subscriptions to plans
- PlanSubscriptionUsage: Tracks feature usage for subscriptions
Events
The package fires several events that you can listen to:
Turahe\Subscription\Events\UserSubscribed
: Fired when a user subscribes to a planTurahe\Subscription\Events\SubscriptionUpdated
: Fired when a subscription is updatedTurahe\Subscription\Events\SubscriptionCancelled
: Fired when a subscription is cancelled
Testing
The package includes comprehensive tests. Run them with:
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This package is open-sourced software licensed under the MIT license.
Support
If you encounter any issues or have questions, please open an issue on GitHub or contact the maintainers.
Note: This package handles subscription logic and plan management. Payment processing is not included and should be handled by your preferred payment gateway (Stripe, PayPal, etc.).
All versions of subscription with dependencies
spatie/eloquent-sortable Version ^4.4
spatie/laravel-sluggable Version ^3.6
turahe/laravel-userstamps Version ^1.0
turahe/master-data Version ^1.0