Download the PHP package eighteen73/laravel-radioactivity without Composer

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

Laravel Radioactivity

Introduction

Give your eloquent models energy so the most active items are easy to find, with extra energy given to recently active items.

Prerequisites

Before you install the package make sure you have queues working and running since Laravel Radioactivity uses it to control the tendencies. Refer to Laravel official documentation in order to configure queues in your project.

Installation

You may install Laravel Radioactivity via Composer:

Next, publish the Laravel Radioactivity configuration and migration files using the vendor:publish command. The configuration file will be placed in your config directory:

And finally, you should run your database migrations:

How it works

Laravel Radioactivity allows you to create a trending system for any model you want. E.g. assuming a half_life set to 24, and receiving 1000 points of energy initially, after 24 hours this energy would be now 500, and continues to decrement exponentially according to the decay equation.

But how can a trend be detected? Imagine that thousands of people hit the same item at the same time, this item will have thousands of energy points and if you have an ordered list of items this one will surely be on top, but after some time if this item doesn't receive any more energy points it will start to lose its energy and decay over time.

To help avoid the energies table growing too large to sort, this package also prunes models with very low energy (according to your min_energy setting).

Configuration

To configure your decaying time you can set the half_life and min_energy parameters in config/radioactivity.php. The half life is measured in hours.

If you want to auto-decay the energy on your models then you also need to add your model to the models section.

Preparing your model

To allow your model to work with Laravel Radioactivity you'll need to implement the HasEnergy trait. And in order to return the current model's energy value, add energy_amount to your serialization.

Usage

To add energy to your model use the following method. By default, 1000 energy is added each time to avoid lots of floating points, but any desired amount can be added by specifying the $amount parameter.

To get the current value:

Schedule

This package uses Laravel Schedule to queue decay jobs for each Model type you configure. Make sure you are running Laravel's Schedule via cron every minute.

Examples

The above code creates a ordered list of items based on radioactivity.

License

Laravel Radioactivity is open-sourced software licensed under the MIT license.

Credits

This plugin is forked from the Laravel Trends package. All due credit to the authors of that package.


All versions of laravel-radioactivity with dependencies

PHP Build Version
Package Version
Requires illuminate/contracts Version ^10.0|^11.0
illuminate/database Version ^10.0|^11.0
illuminate/support Version ^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 eighteen73/laravel-radioactivity contains the following files

Loading the files please wait ....