Docs · Laravel Weighted Distribution · Open source
Installation
9 pages in this guide
Start here
Basic usage
Reference
Requirements
- PHP 8.2 or higher
- Laravel 11.33.2 or higher, 12 or 13 (Laravel 13 needs PHP 8.3)
Only CacheStore, the facade and the service provider depend on Laravel. Everything else works in plain PHP.
Installing the package
You can install the package via composer:
composer require keaton-php/laravel-weighted-distribution
The service provider and the facade are discovered automatically.
Publishing the config file
If you want to use the facade, publish the config file:
php artisan vendor:publish --tag="weighted_distribution-config"
You can then describe your distribution in config/weighted_distribution.php. Settings you leave out keep their defaults. In a Laravel app covers the config file and the facade. Without Laravel you call make() and add the targets with target() or targets(), like the examples in these docs do.
The package is tested on PHP 8.2 to 8.4 against Laravel 11, 12 and 13.
This page is docs/02-installation.md in the package. Every PHP example on it is run by the package's tests, and the output shown is what it printed.