php split testing
1.0.5
Un outil de test A / B / N côté serveur
Cette bibliothèque fournit une couche pour exécuter les tests AB sur vos applications. Le "fractionnement" est utile lorsque vous souhaitez changer quelque chose sur l'application, mais vous souhaitez vérifier l'optimiser en utilisant diverses variations.
$ composer require dimgraycat/split-testing{
"require" : {
"dimgraycat/split-testing" : " ^1.0 "
}
}Et installer les dépendances:
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install <?php
use Ab SplitTesting ;
$ params = array (
' use ' => ' random ' ,
' variation ' => array (
' foo ' ,
' bar ' ,
' baz '
);
);
$ result = SplitTesting:: get ( $ params );
// $seed is optional
// e.g.) userId, IpAddress
$ seed = 1234 ;
echo SplitTesting:: get ( $ params , $ seed ); <?php
use Ab SplitTesting ;
$ params = array (
' use ' => ' rate ' ,
' variation ' => array (
' rate ' => array (
// 1 => 0.1%, 50 => 5%, 500 => 50%, 1000 => 100%
' foo ' => 50 ,
' bar ' => 20 ,
' baz ' => 500 ,
),
' list ' => array (
' default ' => array ( ' hoge ' ),
' a ' => ' 5% ' ,
' hoge ' => 1234567890 ,
' moge ' => ' 123456789 ' ,
),
),
);
echo SplitTesting:: get ( $ params ); <?php
use Ab SplitTesting ;
$ params = array (
' use ' => ' pattern ' ,
' variation ' => array (
' pattern ' => array (
' foo ' => ' /[0-9]$/ ' ,
' bar ' => ' /z$/ ' ,
),
' list ' => array (
' default ' => ' default ' ,
' foo ' => ' hit 1! ' ,
' bar ' => ' hit 2! '
),
),
);
$ seed = 1234 ; // required
echo SplitTesting:: get ( $ params , $ seed ); // hit 1!