Download the PHP package miracuthbert/laravel-royalty without Composer

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

Laravel Royalty

A user points package for Laravel that can be used to give rewards, loyalty or experience points with real time support.

How does it work?

Simply every point has an action file which when called will resolve the model for a given point.

The action file is used to assign points to a user.

The reason we use action (files) is:

Installation

Use composer to install the package:

Setup

The package takes advantage of Laravel Auto-Discovery, so it doesn't require you to manually add the ServiceProvider.

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

You must then publish the config and migrations file.

Using the Setup command

You can do all the necessary setup using the royalty:setup in your command console

Update the keys in "config/royalty.php" before migrating your database You can set the model to be used for points.

If you want to reset either config or migrations use the commands below in your console

Publish Config

Setup the user model key in config to indicate which User model to use

Publish Migrations

Before migrating the database make sure you setup the user model key in config

Publish Vue Components

A simple Vue component is included to display a user's points in real-time anytime they are given points. See Real-time section under usage for more.

The package does not tie you to use a specific front-end framework to listen to the fired event, so feel free to experiment

Usage

Setting the User model

First, setup the user model key in the config.

Then add CollectsPoints trait in the respective model.

Creating Points

Let's take an example of a user completing a Lesson in a course, we can create a CompletedLesson.

Using Console Command

You can use the command:

This will create an action file under the Royalty\Actions folder in the app directory or a corresponding one as specified in the config/royalty.php file.

It will include:

You can also use these options along with the command:

If you just created the point file only you need to create a record with reference to the action in the database.

See Adding Points in the Database section on adding a point in the database.

Creating Manually

To create a point manually you need to create an action file and also a record referencing the action in the database.

Creating the Action File

To create a point action file, you need to create a class that extends Miracuthbert\Royalty\Actions\ActionAbstract.

Adding Points in the Database

You can also create bulk points using, for example a seeder:

Giving Points

To give points, just call the givePoints method on an instance of a user.

Getting User's Points

To get user points, just call the points method on an instance of a user chaining one of the following methods:

Real-time

Whenever a user is given points a PointsGiven event is fired.

Broadcast Channel

It broadcasts to the users (private) channel as set in the channel key of broadcast in config/royalty.php.

The channel should exist in channels file under routes or your respective user channel

An example of the channel route:

Listening to the Event

You can then listen to it using the points-given or the set value of the name key under broadcast in config/royalty.php.

Example using Laravel Echo with Vue.js:

Vue Component

There is a Vue component included with the package. Use command below to publish it:

The published component will be placed in your resources/js/components directory. Once the components have been published, you should register them in your resources/js/app.js file:

After registering the component, make sure to run npm run dev to recompile your assets. Once you have recompiled your assets, you may drop the components into one of your application's templates to get started:

Console Commands

There are three commands within the package:

Security Vulnerabilities

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

Credits

License

The project is open-sourced software licensed under the MIT license.


All versions of laravel-royalty with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
illuminate/console Version ^7.0|^8.0|^9.0|^10.0
illuminate/database Version ^7.0|^8.0|^9.0|^10.0
illuminate/events Version ^7.0|^8.0|^9.0|^10.0
illuminate/http Version ^7.0|^8.0|^9.0|^10.0
illuminate/support Version ^7.0|^8.0|^9.0|^10.0
kalnoy/nestedset Version >=5.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 miracuthbert/laravel-royalty contains the following files

Loading the files please wait ....