https://github.com/utopia-php/ab
Lite & fast micro PHP AB Tests library that is **easy to use**.
https://github.com/utopia-php/ab
hacktoberfest php
Last synced: 9 months ago
JSON representation
Lite & fast micro PHP AB Tests library that is **easy to use**.
- Host: GitHub
- URL: https://github.com/utopia-php/ab
- Owner: utopia-php
- License: mit
- Created: 2019-05-08T07:26:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-11T06:27:06.000Z (about 2 years ago)
- Last Synced: 2025-03-27T22:11:12.537Z (9 months ago)
- Topics: hacktoberfest, php
- Language: PHP
- Homepage:
- Size: 33.2 KB
- Stars: 12
- Watchers: 7
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: Contributing.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Utopia AB Tests
[](https://travis-ci.com/utopia-php/ab)

[](https://appwrite.io/discord)
Utopia AB Tests library is simple and lite library for managing AB tests on the server side. This library is aiming to be as simple and easy to learn and use. This library is maintained by the [Appwrite team](https://appwrite.io).
Although this library is part of the [Utopia Framework](https://github.com/utopia-php/framework) project it is dependency free and can be used as standalone with any other PHP project or framework.
## Getting Started
Install using composer:
```bash
composer require utopia-php/ab
```
```php
variation('title1', 'Hello World', 40) // 40% probability
->variation('title2', 'Foo Bar', 30) // 30% probability
->variation('title3', function () { // 30% probability
return 'Title from a callback function';
}, 30)
;
$debug = [];
for($i=0; $i<10000; $i++) {
$debug[$test->run()]++;
}
var_dump($debug);
```
If no probability value is passed to the variation, all variations with no probability values will be given equal values from the remaining 100% of the test variations.
When passing a closure as value for your variation the callback will be executed only once the test is being run using the Test::run() method.
## System Requirements
Utopia Framework requires PHP 7.4 or later. We recommend using the latest PHP version whenever possible.
## Copyright and license
The MIT License (MIT) [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php)