2017 © Pedro PelĂĄez
 

library analytics-mongodb

Store PhpAB tests participations in MongoDB

image

phpab/analytics-mongodb

Store PhpAB tests participations in MongoDB

  • Monday, May 2, 2016
  • by waltertamboer
  • Repository
  • 3 Watchers
  • 2 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Analytics-MongoDB

Store PhpAb tests participations in MongoDB., (*1)

Note: This is compatible with MongoDB and not with the legacy Mongo library., (*2)

Install

Via Composer, (*3)

$ composer require phpab/analytics-mongodb

Usage

Usage after full PhpAB example., (*4)


use PhpAb\Storage\Cookie; use PhpAb\Participation\Manager; use PhpAb\Analytics\DataCollector\Generic; use PhpAb\Event\Dispatcher; use PhpAb\Participation\Filter\Percentage; use PhpAb\Variant\Chooser\RandomChooser; use PhpAb\Variant\SimpleVariant; use PhpAb\Variant\CallbackVariant; use PhpAb\Engine\Engine; use PhpAb\Test\Test; $storage = new Cookie('phpab'); $manager = new Manager($storage); $analyticsData = new Generic(); $dispatcher = new Dispatcher(); $dispatcher->addSubscriber($analyticsData); $filter = new Percentage(50); $chooser = new RandomChooser(); $engine = new Engine($manager, $dispatcher, $filter, $chooser); $test = new Test('foo_test'); $test->addVariant(new SimpleVariant('_control')); $test->addVariant(new CallbackVariant('v1', function () { echo 'v1'; })); $test->addVariant(new CallbackVariant('v2', function () { echo 'v2'; })); $test->addVariant(new CallbackVariant('v3', function () { echo 'v3'; })); // Add some tests $engine->addTest($test); $engine->start(); // Here starts MongoDB interaction // Provide a MongoDB Collection to be injected $mongoCollection = (new \MongoDB\Client)->phpab->run; // Inject together with Analytics Data $analytics = new \PhpAb\Analytics\MongoDB( $analyticsData->getTestsData(), $mongoCollection ); // Store it providing a user identifier and a scenario // typically a URL or a controller name $result = $analytics->store('1.2.3.4-abc', 'homepage.php'); var_dump($result);

Change log

Please see CHANGELOG for more information what has changed recently., (*5)

Testing

bash $ composer test, (*6)

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*7)

Security

If you discover any security related issues, please open an issue in the issue tracker. We realize this is not ideal but it's the fastest way to get the issue solved., (*8)

Credits

License

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

The Versions

02/05 2016

dev-master

9999999-dev https://github.com/phpab/analytics-mongodb

Store PhpAB tests participations in MongoDB

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb analytics phpab analytics-mongodb