{"id":37009004,"url":"https://github.com/phpab/analytics-pdo","last_synced_at":"2026-01-14T00:51:33.425Z","repository":{"id":57040108,"uuid":"56752212","full_name":"phpab/analytics-pdo","owner":"phpab","description":"Store PhpAb tests participations using PDO DBAL","archived":false,"fork":false,"pushed_at":"2016-05-02T21:06:08.000Z","size":1599,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-17T13:42:45.949Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phpab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-21T07:32:17.000Z","updated_at":"2017-04-02T01:41:13.000Z","dependencies_parsed_at":"2022-08-23T23:30:37.979Z","dependency_job_id":null,"html_url":"https://github.com/phpab/analytics-pdo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/phpab/analytics-pdo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpab%2Fanalytics-pdo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpab%2Fanalytics-pdo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpab%2Fanalytics-pdo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpab%2Fanalytics-pdo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpab","download_url":"https://codeload.github.com/phpab/analytics-pdo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpab%2Fanalytics-pdo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28407320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T00:51:32.712Z","updated_at":"2026-01-14T00:51:33.387Z","avatar_url":"https://github.com/phpab.png","language":"PHP","readme":"# Analytics-PDO\n\nStore [PhpAb](https://github.com/phpab/phpab) tests participations using [PDO DBAL](http://php.net/manual/en/book.pdo.php).\n\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require phpab/analytics-pdo\n```\nMake sure you have installed the PDO driver you intend to use too.\n\n## Usage\n\nThis example assumes you have a sqlite3 database created in the same folder where this script is located.\nThe sqlite3 definition can be found [here](example/run.sql).\n\n``` php\n\nuse PhpAb\\Storage\\Cookie;\nuse PhpAb\\Participation\\Manager;\nuse PhpAb\\Analytics\\DataCollector\\Generic;\nuse PhpAb\\Event\\Dispatcher;\nuse PhpAb\\Participation\\Filter\\Percentage;\nuse PhpAb\\Variant\\Chooser\\RandomChooser;\nuse PhpAb\\Engine\\Engine;\nuse PhpAb\\Test\\Test;\nuse PhpAb\\Variant\\SimpleVariant;\nuse PhpAb\\Variant\\CallbackVariant;\n\n$storage = new Cookie('phpab');\n$manager = new Manager($storage);\n\n$analyticsData = new Generic();\n\n$dispatcher = new Dispatcher();\n$dispatcher-\u003eaddSubscriber($analyticsData);\n\n$filter = new Percentage(50);\n$chooser = new RandomChooser();\n\n$engine = new Engine($manager, $dispatcher, $filter, $chooser);\n\n$test = new Test('foo_test');\n$test-\u003eaddVariant(new SimpleVariant('_control'));\n$test-\u003eaddVariant(new CallbackVariant('v1', function () {\n    echo 'v1';\n}));\n$test-\u003eaddVariant(new CallbackVariant('v2', function () {\n    echo 'v2';\n}));\n$test-\u003eaddVariant(new CallbackVariant('v3', function () {\n    echo 'v3';\n}));\n\n// Add some tests\n$engine-\u003eaddTest($test);\n\n$engine-\u003estart();\n\n// Here starts PDO interaction\n$pdo = new PDO('sqlite:./phpab.db');\n\n$options = [\n    'runTable' =\u003e 'Run',\n    'testIdentifierField' =\u003e 'testIdentifier',\n    'variantIdentifierField' =\u003e 'variantIdentifier',\n    'userIdentifierField' =\u003e 'userIdentifier',\n    'scenarioIdentifierField' =\u003e 'scenarioIdentifier',\n    'runIdentifierField' =\u003e 'runIdentifier',\n    'createdAtField' =\u003e 'createdAt'\n];\n\n// Inject PDO instance together with Analytics Data\n$analytics = new \\PhpAb\\Analytics\\PDO(\n    $analyticsData-\u003egetTestsData(),\n    $pdo,\n    $options\n);\n\n// Store it providing a user identifier and a scenario\n// typically a URL or a controller name\n\n$analytics-\u003estore('1.2.3.4-abc', 'homepage.php');\n\n```\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.\n\n## Security\n\nIf you discover any security related issues, please open an issue in the issue tracker. We realize\nthis is not ideal but it's the fastest way to get the issue solved.\n\n## Credits\n\n- [Mariano F.co Benítez Mulet](https://github.com/pachico)\n- [All Contributors](https://github.com/phpab/analytics-pdo/graphs/contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpab%2Fanalytics-pdo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpab%2Fanalytics-pdo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpab%2Fanalytics-pdo/lists"}