{"id":21050959,"url":"https://github.com/theopenwebjp/simple-php-ab-tester","last_synced_at":"2026-05-21T18:08:11.896Z","repository":{"id":90636852,"uuid":"479189393","full_name":"theopenwebjp/simple-php-ab-tester","owner":"theopenwebjp","description":"Configurable simple AB tester for PHP","archived":false,"fork":false,"pushed_at":"2024-08-01T15:31:56.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T18:36:12.863Z","etag":null,"topics":["ab-testing","php","testing"],"latest_commit_sha":null,"homepage":"","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/theopenwebjp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-08T00:20:29.000Z","updated_at":"2024-08-01T15:28:54.000Z","dependencies_parsed_at":"2024-11-19T15:49:04.792Z","dependency_job_id":"d1a75241-e3c4-4908-b43a-632c36d58440","html_url":"https://github.com/theopenwebjp/simple-php-ab-tester","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theopenwebjp%2Fsimple-php-ab-tester","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theopenwebjp%2Fsimple-php-ab-tester/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theopenwebjp%2Fsimple-php-ab-tester/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theopenwebjp%2Fsimple-php-ab-tester/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theopenwebjp","download_url":"https://codeload.github.com/theopenwebjp/simple-php-ab-tester/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243495377,"owners_count":20299924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ab-testing","php","testing"],"created_at":"2024-11-19T15:48:52.078Z","updated_at":"2025-12-26T19:00:05.383Z","avatar_url":"https://github.com/theopenwebjp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Description\n\nSimple PHP AB Tester.\n\nMain functionality is done by copy/pasting this directory AND using an if function.\n\nExtra functionality is available here: 「ab-test-id standard」.\n\n## Reason for Making\n\nPHP AB Testers already exist.\nHowever, they often require composer installation, and don't abstract the important parts.\nThis library aims to be simple and do what is desired with no building, programming, and little need for adding configuration.\n\n## Specification\n\n- Allow for randomization by probability\n- Allow for more than 2\n- Allow for manual testing using private GET key for override\n- Disallow direct access\n\n## Usage\n\n### Via _AB directory\n\n1. Copy _AB template directory to parent directory where being used.\n2. Add original and any other AB target files to _AB/inputs/.\n3. Optionally(※However always change \"manualAccessKey\" in settings.json at least for the first time.) make any desired changes to the _AB/settings.json file.\n4. Replace target file with \"\u003c?php require_once(__DIR__ . \"_AB/index.php\");\"\n5. Open! To manually override settings, use ?manualAccessKey=[MANUAL_ACCESS_KEY]\u0026target=[TARGET_FILE_NAME].\n\n### Via Utility functions\n\n- See 「ab-test-id standard」.\n\n## Settings\n\n[._AB/settings.json](._AB/settings.json)\n\n- manualAccessKey: The key for allowing manual access.\n- randomization: How to handle randomization in selection of pages. Falsy(false, \"\", ...): Equal chance for all. Map of filename to number to map probabilities. Chance is calculated from total of all probabilities.\n- debug: Set debug to true to output useful information. Mainly error information.\n\n## Loading utility functions\n\n- If using _AB directory in same directory: `require_once(__DIR__ . \"_AB/index.php\");`\n- If repository is in same directory: `require_once(__DIR__ . '/simple-php-ab-tester/src/utilities.php');`\n- If loaded via composer: `require_once(__DIR__ . '/vendor/simple-php-ab-tester/src/utilities.php');`\n\n## Other implementations\n\n### ab-test-id standard\n\n- This library provides a PHP utility function to perform AB testing. Although it is simple to recreate, it is implemented [here](src\\utilities.php) because of being related and using PHP, and to standardize a way to do in PHP.\n  - Load(Do once per app): `require_once(__DIR__ . '/simple-php-ab-tester/src/utilities.php');`\n  - Check via GET: `if (getABTestId('MYID')) { ... } else { ... }`\n  - Check via SESSION:\n    - Start: `startABTestSession()`\n    - Check: `if(isInABTestSession()) { ... } else { ... }`\n    - End: `endABTestSession()`\n- The above implementation is implemented in HTML, JS, in the following private repository(※ MAY consider making public upon popular request.): [private-js-code/src/classes/ab-tester](https://gitlab.com/dammyg/private-js-code/-/blob/master/src/classes/ab-tester.js).\n- The above uses \"ab-test-id\" as the GET key.\n\n## Examples\n\nCreate AB test using utility functions with existing file:\n\n```php\n// Original file: Rename to _[ORIGINAL_FILE_NAME].php\n// ...\n\n// AB test file: _AB_[ORIGINAL_FILE_NAME].php\n// ...\n\n// New file: Replace [ORIGINAL_FILE_NAME].php\nrequire_once(__DIR__ . '/simple-php-ab-tester/src/utilities.php');\nif (getABTestId('MYID')) { // ID SHOULD BE SECRET AND HARD ENOGUH TO BREAK SO CAN NOT LEAK DEV ISSUES AND POSSIBLE SECURITY ISSUES. \n    require_once(__DIR__ . '/_AB_[ORIGINAL_FILE_NAME].php');\n} else {\n    require_once(__DIR__ . '/_[ORIGINAL_FILE_NAME].php');\n}\n```\n\n## Testing\n\nThis library can be tested using the following manual process:\n\n- Although not required, consider copying this entire repository, and use _AB in place.\n- Follow [Usage], using your server with PHP available, and adding the files from [test/files](./test/files/) into the inputs directory.\n- Place [test/index.php](./test/index.php) into the directory at the same level as _AB. ※It is perfectly OK to rename index.php.\n- Go to the PHP file added previously, and check that it correctly alternates between echoing different file names.\n- Test manual access key: `?manualAccessKey=[MANUAL_ACCESS_KEY]\u0026target=[TARGET_FILE_NAME]`.\n- Test randomization settings.\n\n## License\n\n[LICENSE](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheopenwebjp%2Fsimple-php-ab-tester","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheopenwebjp%2Fsimple-php-ab-tester","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheopenwebjp%2Fsimple-php-ab-tester/lists"}