Download the PHP package rinvex/subscriptions without Composer

On this page you can find all versions of the php package rinvex/subscriptions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package subscriptions

Rinvex Subscriptions

Rinvex Subscriptions is a flexible plans and subscription management system for Laravel, with the required tools to run your SAAS like services efficiently. It's simple architecture, accompanied by powerful underlying to afford solid platform for your business.

⚠️ This package is renamed and now maintained at rinvex/laravel-subscriptions, author suggests using the new package instead. Old package supportes up to Laravel v5.6, and the new one supports Laravel v5.7+

Packagist Scrutinizer Code Quality Code Climate Travis StyleCI License

Considerations

Installation

  1. Install the package via composer:

  2. Execute migrations via the following command:

  3. Done!

Usage

Add Subscriptions to User model

Rinvex Subscriptions has been specially made for Eloquent and simplicity has been taken very serious as in any other Laravel related aspect. To add Subscription functionality to your User model just use the \Rinvex\Subscriptions\Traits\HasSubscriptions trait like this:

That's it, we only have to use that trait in our User model! Now your users may subscribe to plans.

Create a Plan

Get Plan Details

You can query the plan for further details, using the intuitive API as follows:

Both $plan->features and $plan->subscriptions are collections, driven from relationships, and thus you can query these relations as any normal Eloquent relationship. E.g. $plan->features()->where('name', 'listing_title_bold')->first().

Get Feature Value

Say you want to show the value of the feature _pictures_perlisting from above. You can do so in many ways:

Create a Subscription

You can subscribe a user to a plan by using the newSubscription() function available in the HasSubscriptions trait. First, retrieve an instance of your subscriber model, which typically will be your user model and an instance of the plan your user is subscribing to. Once you have retrieved the model instance, you may use the newSubscription method to create the model's subscription.

The first argument passed to newSubscription method should be the title of the subscription. If your application offer a single subscription, you might call this main or primary. The second argument is the plan instance your user is subscribing to.

Change the Plan

You can change subscription plan easily as follows:

If both plans (current and new plan) have the same billing frequency (e.g., invoice_period and invoice_interval) the subscription will retain the same billing dates. If the plans don't have the same billing frequency, the subscription will have the new plan billing frequency, starting on the day of the change and the subscription usage data will be cleared. Also if the new plan has a trial period and it's a new subscription, the trial period will be applied.

Feature Options

Plan features are great for fine tuning subscriptions, you can topup certain feature for X times of usage, so users may then use it only for that amount. Features also have the ability to be resettable and then it's usage could be expired too. See the following examples:

Subscription Feature Usage

There's multiple ways to determine the usage and ability of a particular feature in the user subscription, the most common one is canUseFeature:

The canUseFeature method returns true or false depending on multiple factors:

Other feature methods on the user subscription instnace are:

All methods share the same signature: e.g. $user->subscription('main')->getFeatureUsage('listings');.

Record Feature Usage

In order to effectively use the ability methods you will need to keep track of every usage of each feature (or at least those that require it). You may use the recordFeatureUsage method available through the user subscription() method:

The recordFeatureUsage method accept 3 parameters: the first one is the feature's name, the second one is the quantity of uses to add (default is 1), and the third one indicates if the addition should be incremental (default behavior), when disabled the usage will be override by the quantity provided. E.g.:

Reduce Feature Usage

Reducing the feature usage is almost the same as incrementing it. Here we only substract a given quantity (default is 1) to the actual usage:

Clear The Subscription Usage Data

Check Subscription Status

For a subscription to be considered active one of the following must be true:

Alternatively you can use the following methods available in the subscription model:

Canceled subscriptions with an active trial or ends_at in the future are considered active.

Renew a Subscription

To renew a subscription you may use the renew method available in the subscription model. This will set a new ends_at date based on the selected plan and will clear the usage data of the subscription.

Canceled subscriptions with an ended period can't be renewed.

Cancel a Subscription

To cancel a subscription, simply use the cancel method on the user's subscription:

By default the subscription will remain active until the end of the period, you may pass true to end the subscription immediately:

Scopes

Subscription Model

Models

Rinvex Subscriptions uses 4 models:

Changelog

Refer to the Changelog for a full history of the project.

Support

The following support channels are available at your fingertips:

Contributing & Protocols

Thank you for considering contributing to this project! The contribution guide can be found in CONTRIBUTING.md.

Bug reports, feature requests, and pull requests are very welcome.

Security Vulnerabilities

If you discover a security vulnerability within this project, please send an e-mail to [email protected]. All security vulnerabilities will be promptly addressed.

About Rinvex

Rinvex is a software solutions startup, specialized in integrated enterprise solutions for SMEs established in Alexandria, Egypt since June 2016. We believe that our drive The Value, The Reach, and The Impact is what differentiates us and unleash the endless possibilities of our philosophy through the power of software. We like to call it Innovation At The Speed Of Life. That’s how we do our share of advancing humanity.

License

This software is released under The MIT License (MIT).

(c) 2016-2018 Rinvex LLC, Some rights reserved.


All versions of subscriptions with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3
illuminate/console Version ~5.6.0
illuminate/database Version ~5.6.0
illuminate/support Version ~5.6.0
nesbot/carbon Version ~1.22
rinvex/cacheable Version dev-develop
rinvex/support Version dev-develop
spatie/eloquent-sortable Version ^3.4.0
spatie/laravel-sluggable Version ^2.1.0
spatie/laravel-translatable Version ^2.1.0
watson/validating Version ^3.1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rinvex/subscriptions contains the following files

Loading the files please wait ....