Download the PHP package jojostx/larasubs without Composer

On this page you can find all versions of the php package jojostx/larasubs. 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 larasubs

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

About

This package provides a straightforward interface to handle subscriptions and features consumption.

Considerations

Installation

You can install the package via composer:

Publish resources (config and migrations files):

Usage

To start using it, you just have to add the Jojostx\Larasubs\Models\Concerns\HasSubscriptions trait to your User model (or any model you want to have subscriptions):

And that's it!

Setting Plans Up

First things first, you have to define the plans you'll offer. In the example below, we are creating two plans.

Everything here is quite simple, but it is worth to emphasize: by receiving the interval options above, the two plans are defined as yearly with a 1 month trial period and grace period.

Trial Period

You can define a trial period for each plan, so your users will can access a plan on trial before the subscription starts:

Grace Period

You can define a grace period for each plan, so your users will not loose access to their features immediately when the subscription ends.

Setting Up Features

Next, you may define the features your plan will offer. In the example below, we are creating two features. In the example below, we are creating two features: one to handle how much minutes each user can spend with deploys and if they can use subdomains.

Associating Plans with Features

As each feature can belong to multiple plans (and they can have multiple features), you have to associate them:

It is necessary to pass a value to units when associating a consumable feature with a plan.

In the example above, we are giving 15 minutes of deploy time to silver users and 25 to gold users. We are also allowing gold users to use subdomains.

Subscribing

Now that you have a set of plans with their own features, it is time to subscribe users to them. Registering subscriptions is quite simple:

In the example above, we are simulating an application that subscribes its users when their payments are approved. It is easy to see that the method subscribeTo requires only two arguments:

There are other options you can pass to it to handle particular cases that we're gonna cover below.

By default, the subscribeTo method calculates the expiration considering the plan's 'Interval' options, so you don't have to worry about it.

Testing

Security Policy

If you discover any security related issues, please send an email instead of using the issue tracker.

Support

The following support channels are available at your fingertips:

License

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

(c) 2022 Jojostx, Some rights reserved.


All versions of larasubs with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1
illuminate/console Version ^8.0|^9.0
illuminate/contracts Version ^8.0|^9.0
illuminate/database Version ^8.0|^9.0
illuminate/support Version ^8.0|^9.0
spatie/eloquent-sortable Version ^4.0
spatie/laravel-schemaless-attributes Version ^2.3
spatie/laravel-sluggable Version ^3.4
spatie/laravel-translatable Version ^6.1
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 jojostx/larasubs contains the following files

Loading the files please wait ....