Download the PHP package tlsgroup/laravel-referral without Composer

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

The "TLSGROUP/laravel-referral" package is a custom Laravel package that provides referral code functionality for your Laravel applications. It allows you to generate referral codes, associate them with users, retrieve users based on their referral codes and all other related features.

Installation

You can install the package via Composer by running the following command:

Configuration

The package provides a configuration file that allows you to customize its behavior. You should publish the migration and the config/referral.php config file with:

After publishing, you can find the configuration file at config/referral.php.

Configuration Key Description
cookie_name The name of the cookie that tracks referrals.
cookie_expiry How long the referral cookie will be valid. (Default: 1 year)
route_prefix The prefix used for referral links.
ref_code_prefix The prefix added to the unique referral code for each user.
redirect_route The page where users will go after clicking on a referral link.
user_model The model class for the user.
referral_length The length of the referral code for each user. (Default: 8 characters)

These configuration options help customize the behavior of the referral system in your Laravel application. Feel free to adjust these values according to your preferences and requirements!

Migration

After the config and migration have been published and configured, you can create the tables for this package by running:

Add Trait

Add the necessary trait to your User model:

Usage

Generate Referral Accounts for Existing Users

To generate referral accounts for existing users, you can visit the following URL:

This will generate referral codes for all existing users in your application.

Get the Referrer of a User

To get the referrer of a user, you can use the following code:

This retrieves the referrer associated with the user.

Get Referrer by Referral Code

To get the referrer by referral code, you can use the following code:

This retrieves the referrer based on the referral code stored in the cookie.

Check if a User has a Referral Account

To check if a user has a referral account, you can use the following code:

This returns true if the user has a referral account, and false otherwise.

Create a Referral Account for a User

To create a referral account for a user, you can use the following code:

This associates the user with the provided referrer by creating a referral account.

Get All Referrals of a User

To get all referrals under a user, you can use the following code:

This retrieves all the referrals associated with the user.

Get the Referral Link of a User

To get the referral link of a user, you can use the following code:

This returns the referral link associated with the user.

License

The Laravel Referral Package is open-source software licensed under the MIT license.


All versions of laravel-referral with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2.0
illuminate/database Version ^8.0|^9.0|^10.0|^11.0
illuminate/auth Version ^8.0|^9.0|^10.0|^11.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 tlsgroup/laravel-referral contains the following files

Loading the files please wait ....