{"id":17289114,"url":"https://github.com/ben182/laravel-ab","last_synced_at":"2025-04-06T12:10:52.053Z","repository":{"id":34087209,"uuid":"168840386","full_name":"ben182/laravel-ab","owner":"ben182","description":"Laravel A/B experiment testing tool","archived":false,"fork":false,"pushed_at":"2023-12-12T05:00:41.000Z","size":67,"stargazers_count":110,"open_issues_count":6,"forks_count":25,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-30T11:07:12.694Z","etag":null,"topics":["ab-testing","laravel","laravel-5-package","laravel-package","php"],"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/ben182.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-02T14:32:32.000Z","updated_at":"2024-10-17T13:02:02.000Z","dependencies_parsed_at":"2024-10-31T00:00:55.489Z","dependency_job_id":"4c5b1d11-b4b7-48d6-af5c-a2972dd992dd","html_url":"https://github.com/ben182/laravel-ab","commit_stats":{"total_commits":67,"total_committers":5,"mean_commits":13.4,"dds":"0.11940298507462688","last_synced_commit":"627507de274b5c51b8fe93b67cfaece69adbe238"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben182%2Flaravel-ab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben182%2Flaravel-ab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben182%2Flaravel-ab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben182%2Flaravel-ab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ben182","download_url":"https://codeload.github.com/ben182/laravel-ab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478324,"owners_count":20945266,"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","laravel","laravel-5-package","laravel-package","php"],"created_at":"2024-10-15T10:33:38.364Z","updated_at":"2025-04-06T12:10:52.034Z","avatar_url":"https://github.com/ben182.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch6 align=\"center\"\u003e\n    \u003cimg src=\"https://i.ibb.co/hy7fjMG/Laravel-AB.png\" width=\"300\"/\u003e\n\u003c/h6\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/ben182/laravel-ab/releases\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/c3ce61db6a98f1a6d141a4fc3b3f83c182674ba8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f62656e3138322f6c61726176656c2d61622e7376673f7374796c653d666c61742d737175617265\" alt=\"Latest Version\" data-canonical-src=\"https://img.shields.io/github/release/ben182/laravel-ab.svg?style=flat-square\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n\u003ca href=\"https://travis-ci.org/ben182/laravel-ab\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/7994c56ad88fb3e839360835571cc670d88af2e2/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f62656e3138322f6c61726176656c2d61622f6d61737465722e7376673f7374796c653d666c61742d737175617265\" alt=\"Build Status\" data-canonical-src=\"https://img.shields.io/travis/ben182/laravel-ab/master.svg?style=flat-square\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n\u003ca href=\"https://scrutinizer-ci.com/g/ben182/laravel-ab\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/88e5e8e14c12f93518fa07a025a15893ae8772e4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f62656e3138322f6c61726176656c2d61622e7376673f7374796c653d666c61742d737175617265\" alt=\"Quality Score\" data-canonical-src=\"https://img.shields.io/scrutinizer/g/ben182/laravel-ab.svg?style=flat-square\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n\u003ca href=\"https://scrutinizer-ci.com/g/ben182/laravel-ab/?branch=master\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/de896bb05aa6d6224d2c1e7be81c36b18895128d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62656e3138322f6c61726176656c2d61622f6261646765732f636f7665726167652e706e673f623d6d6173746572\" alt=\"Code Coverage\" data-canonical-src=\"https://scrutinizer-ci.com/g/ben182/laravel-ab/badges/coverage.png?b=master\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\nThis package helps you to find out which content works on your site and which doesn't.\n\nIt allows you to create experiments and goals. The visitor will receive randomly the next experiment and you can customize your site to that experiment. The view and the goal conversion will be tracked and you can view the results in a report.\n\n## Installation\n\nThis package can be used in Laravel 5.6 or higher.\n\nYou can install the package via composer:\n\n```bash\ncomposer require ben182/laravel-ab\n```\n\n## Config\n\nAfter installation publish the config file:\n\n```bash\nphp artisan vendor:publish --provider=\"Ben182\\AbTesting\\AbTestingServiceProvider\"\n```\n\nYou can define your experiments and goals in there.\n\nFinally, run the newly added migration\n\n```bash\nphp artisan migrate\n```\n\nTwo new migrations should be added.\n\n## Usage\n\n### Experiments\n\n```html\n@if (AbTesting::isExperiment('logo-big'))\n\n    \u003cdiv class=\"logo-big\"\u003e\u003c/div\u003e\n\n@elseif (AbTesting::isExperiment('logo-grayscale'))\n\n    \u003cdiv class=\"logo-greyscale\"\u003e\u003c/div\u003e\n\n@elseif (AbTesting::isExperiment('brand-name'))\n\n    \u003ch1\u003eBrand name\u003c/h1\u003e\n\n@endif\n```\n\nThat's the most basic usage of the package. You don't have to initialize anything. The package handles everything for you if you call `isExperiment`\n\nAlternatively you can use a custom blade if statement:\n\n```html\n@ab('logo-big')\n\n    \u003cdiv class=\"logo-big\"\u003e\u003c/div\u003e\n\n@elseab('logo-grayscale')\n\n    \u003cdiv class=\"logo-greyscale\"\u003e\u003c/div\u003e\n\n@elseab('brand-name')\n\n    \u003ch1\u003eBrand name\u003c/h1\u003e\n\n@endab\n```\n\nThis will work exactly the same way.\n\nIf you don't want to make any continual rendering you can call\n\n```php\nAbTesting::pageView()\n```\n\ndirectly and trigger a new page view with a random experiment. This function will also be called from `isExperiment`.\n\nUnder the hood a new session item will keep track of the current experiment. A session will only get one experiment and only trigger one page view.\n\nYou can grab the current experiment with:\n\n```php\n// get the underlying model\nAbTesting::getExperiment()\n\n// get the experiment name\nAbTesting::getExperiment()-\u003ename\n\n// get the visitor count\nAbTesting::getExperiment()-\u003evisitors\n```\n\nAlternatively there is a request helper for you:\n\n```php\npublic function index(Request $request) {\n    // the same as 'AbTesting::getExperiment()'\n    $request-\u003eabExperiment()\n}\n```\n\n### Goals\n\nTo complete a goal simply call:\n\n```php\nAbTesting::completeGoal('signup')\n```\n\nThe function will increment the conversion of the goal assigned to the active experiment. If there isn't an active experiment running for the session one will be created. You can only trigger a goal conversion once per session. This will be prevented with another session item. The function returns the underlying goal model.\n\nTo get all completed goals for the current session:\n\n```php\nAbTesting::getCompletedGoals()\n```\n\n### Bots and crawlers\n\nThe package can try to ignore bots and crawlers from registering pageviews. Just enable the `ignore_crawlers` option in the config.\n\n### Report\n\nTo get a report of the page views, completed goals and conversion call the report command:\n\n```bash\nphp artisan ab:report\n```\n\nThis prints something like this:\n\n```\n+---------------+----------+-------------+\n| Experiment    | Visitors | Goal signup |\n+---------------+----------+-------------+\n| big-logo      | 2        | 1 (50%)     |\n| small-buttons | 1        | 0 (0%)      |\n+---------------+----------+-------------+\n```\n\n### Reset\n\nTo reset all your visitors and goal completions call the reset command:\n\n```bash\nphp artisan ab:reset\n```\n\n### Events\n\nIn addition you can hook into two events:\n\n- `ExperimentNewVisitor` gets triggered once an experiment gets assigned to a new visitor. You can grab the experiment as a property of the event.\n- `GoalCompleted` gets triggered once a goal is completed. You can grab the goal as a property of the event.\n\n### Testing\n\n``` bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email moin@benjaminbortels.de instead of using the issue tracker.\n\n## Credits\n\n- [Benjamin Bortels](https://github.com/ben182)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n## Laravel Package Boilerplate\n\nThis package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fben182%2Flaravel-ab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fben182%2Flaravel-ab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fben182%2Flaravel-ab/lists"}