Download the PHP package ansezz/laravel-gamify without Composer

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

πŸ† Laravel Gamify πŸ•Ή

Laravel Gamify: Gamification System with Points & Badges support

Latest Version on Packagist Build Status Total Downloads

Latest Version on Packagist

Use ansezz/laravel-gamify to quickly add point & badges in your Laravel app.

Installation

1 - You can install the package via composer:

2 - If you are installing on Laravel 5.4 or lower you will be needed to manually register Service Provider by adding it in config/app.php providers array.

In Laravel 5.5 and above the service provider automatically.

3 - Now publish the migration for gamify tables:

Note: It will generate migration for points, badges, gamify_groups, pointables, badgables tables, you will need to run composer require doctrine/dbal in order to support dropping and adding columns.

You can publish the config file:

If your payee (model who will be getting the points) model is App\User then you don't have to change anything in config/gamify.php.

Getting Started

1. After package installation now add the Gamify trait on App\User model or any model who acts as user in your app.

⭐️Point πŸ‘‘

2. Next step is to create a point.

  • The point class is option because we save the point in database.
  • You can create a point directly in your database without class.
  • Create the point class if you need to add a check before achieve the point or if you wanna define a dynamic point value.

They will ask you if you wanna create the database badge record.

class attribute in badges table will take the class with namespace in this case: App\Gamify\Points\PostCreated

It will create a Point class named PostCreated under app/Gamify/Points/ folder.

in __invoke you can add any condition to check if user achieve the point else return true , esle we use config('gamify.point_is_archived') by default you can change it in you config file gamify.php.

Give point to User

Undo a given point

In some cases you would want to undo a given point.

You can also pass second argument as $event (Boolean) in function achievePoint & undoPoint ($point, $event), default is true, to disable sending PointsChanged event.

Pro Tip πŸ‘Œ You could also hook into the Eloquent model event and give point on created event. Similarly, deleted event can be used to undo the point.

Get total reputation

To get the total user points achieved you have achieved_points attribute available..

Get points history

the package stores all the points event log so you can get the history of points via the following relation:

Get badges history

the package stores all the badges in database so you can get the history of badges via the following relation:

Event on points changed

Whenever user point changes it fires \Ansezz\Gamify\Events\PointsChanged event which has the following payload:

This event also broadcast in configured channel name so you can listen to it from your frontend via socket to live update points.

πŸ… Achievement Badges πŸ†

Similar to Point type you have badges. They can be given to users based on rank or any other criteria. You should define badge level in config file.

Create a Badge

To generate a badge you can run following provided command:

They will ask you if you wanna create the database badge record.

class attribute in badges table will take the class with namespace in this case: App\Gamify\Badges\PostCreated

It will create a BadgeType class named PostCreated under app/Gamify/Badges/ folder.

For each level you need to define a function by level name to check if the subject is achieve the badge, esle we use config('gamify.badge_is_archived') by default you can change it in you config file gamify.php.

Check if badge is Achieved by subject

Sync All badges

Sync One badge

Event on badge achieved

Whenever user point changes it fires \Ansezz\Gamify\Events\BadgeAchieved event which has the following payload:

Config Gamify

Changelog

Please see CHANGELOG for more information on what has changed recently.

Testing

The package contains some integration/smoke tests, set up with Orchestra. The tests can be run via phpunit.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-gamify with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
laravel/framework Version ~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.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 ansezz/laravel-gamify contains the following files

Loading the files please wait ....