{"id":31270667,"url":"https://github.com/abrouter/laravel-abtest","last_synced_at":"2026-02-05T15:34:59.899Z","repository":{"id":37989260,"uuid":"414733249","full_name":"abrouter/laravel-abtest","owner":"abrouter","description":"ABRouter Laravel AB test is a simple package for the base library to run ab-tests and feature flags via ABRouter with Laravel. Prepare and run your ab-test in 10 minutes. Easy to manage and run. Can be also used as a feature flag or feature toggle. Free cloud version available for free. Completely open-source.","archived":false,"fork":false,"pushed_at":"2025-05-04T00:48:55.000Z","size":109,"stargazers_count":108,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-22T01:47:01.615Z","etag":null,"topics":["ab-testing","ab-testing-php","ab-tests-laravel","experiments","experiments-php","feature-flags","feature-toggle","feature-toggle-php","laravel","laravel-ab-tests","php","tracking-funnel"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abrouter.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null}},"created_at":"2021-10-07T19:32:47.000Z","updated_at":"2025-09-18T05:15:20.000Z","dependencies_parsed_at":"2025-05-04T01:34:39.089Z","dependency_job_id":null,"html_url":"https://github.com/abrouter/laravel-abtest","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/abrouter/laravel-abtest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrouter%2Flaravel-abtest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrouter%2Flaravel-abtest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrouter%2Flaravel-abtest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrouter%2Flaravel-abtest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abrouter","download_url":"https://codeload.github.com/abrouter/laravel-abtest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrouter%2Flaravel-abtest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29124802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T14:05:12.718Z","status":"ssl_error","status_checked_at":"2026-02-05T14:03:53.078Z","response_time":65,"last_error":"SSL_read: 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":["ab-testing","ab-testing-php","ab-tests-laravel","experiments","experiments-php","feature-flags","feature-toggle","feature-toggle-php","laravel","laravel-ab-tests","php","tracking-funnel"],"created_at":"2025-09-23T19:02:19.469Z","updated_at":"2026-02-05T15:34:59.881Z","avatar_url":"https://github.com/abrouter.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# ABRouter Laravel A/B Tests | Split Tests\n\nABRouter AB Test :construction_worker_woman: is a simple package for base library to run A/B tests via [ABRouter (open-source)](https://abrouter.com) with Laravel.\nYou can find base PHP library in https://github.com/abrouter/abrouter-php-client\n\nYou're welcome to [visit the docs](https://docs.abrouter.com/docs/intro/).\n\n[Learn how to deploy ABRouter on your server](https://github.com/abrouter/abrouter).\n\n\n# What is the ABRouter service ? \n\n[ABRouter](https://abrouter.com) is the open-source product to manage experiments(A/B split tests). The service provides easy to manage dashboard to keep experiments under control.\nYou can create experiments, branches and set up a percentage for every branch. Then, when you're running an ab-test on PHP you will receive a perfect branch-wise response that following the rules, that you set up.\n\nProviding feature flags(feature toggles)\nAvailable for free and open-source. \n\nYou can find the ABRouter product source code by the following link: https://github.com/abrouter/compose\n\n## Features\n\n🛠 A/B Tests\n\n🛠 Feature flags\n\n🛠 Built-in statistics\n\n🛠 Incredible UI to manage it \n\n🛠 Parallel running (non-blocking A/B tests running)\n\n\n## Prepare your first A/B test\nBesides of the installing this package you need to have an account on [ABRouter](https://abrouter.com). Your token and experiment id will be also there.\nFeel free to read step by step instruction [Impelementing A/B tests on Laravel](https://abrouter.com/en/laravel-ab-tests)\n\n## :package: Install\nVia composer\n\n``` bash\n$ composer require abrouter/laravel-abtest\n```\n\n## Setting service provider\nThis package provide auto discovery for service provider\n\nIf Laravel package auto-discovery is disabled, add service providers manually to /config/app.php. There are service provider you must add:\n\n```\n\\Abrouter\\LaravelClient\\Providers\\AbrouterServiceProvider::class\n```\n\n### Publish client configuration:\n\n```bash\nphp artisan vendor:publish --tag=abrouter\n```\n\n### Configure ABRouter client:\n\nPut your ABRouter token in /config/abrouter.php. You can find this token in [ABRouter dashboard](https://abrouter.com/en/board).\n\n```php\n\nuse Abrouter\\LaravelClient\\Bridge\\KvStorage;\nuse Abrouter\\LaravelClient\\Bridge\\ParallelRunning\\TaskManager;\n\nreturn [\n    'token' =\u003e '14da89de1713a74c1ed50aafaff18c24bf372a9913e67e6a7a915def3332a97c9c9ecbe2cd6d3047',\n    'host' =\u003e 'https://abrouter.com',\n    'parallelRunning' =\u003e [\n        'enabled' =\u003e true, //parallel running, enabled by default. See next section.\n        'taskManager' =\u003e TaskManager::class,\n    ],\n    'kvStorage' =\u003e KvStorage::class\n];\n```\n\n### Configure Parallel running\n\nParallel running is a feature that allows you to run A/B tests asynchronously. \nIt requires ready-to-use Laravel cache (probably by Redis). \n\nThis feature enables caching of experiment branches to run the experiment locally, then using Laravel built-in queues to sync the data with ABRouter server.\nPlease make sure, your supervisor config, queues and caching storage is enabled in Laravel to use.\n\nParallel running allows to run your A/B tests without blocking. \nAdditionally, you can configure it on your own.\n\n## :rocket: Running A/B tests\n\n```php\nuse Abrouter\\Client\\Client;\n\nclass ExampleController\n{\n    public function __invoke(Client $client)\n    {\n        $userId = auth()-\u003euser()-\u003eid;\n        $buttonColor = $client-\u003eexperiments()-\u003erun($userId, 'button_color');\n        return view('button', [\n            'color' =\u003e $buttonColor-\u003egetBranchId(),\n        ]);\n    }\n}\n```\n## :rocket: Running feature flags\n\n```php\nuse Abrouter\\Client\\Client;\n\nclass ExampleController\n{\n    public function __invoke(Client $client)\n    {\n        $isEnabledButton = $client-\u003efeatureFlags()-\u003erun('enabled_button_feature_flag');\n\n        return view('featureFlags', [\n            'enabledButtonFeatureFlag' =\u003e $isEnabledButton,\n        ]);\n    }\n}\n```\n\n## :rocket: Sending the stats\n\n```php\nuse Abrouter\\Client\\Client;\nuse Abrouter\\Client\\Builders\\StatEventBuilder;\n\nclass ExampleController\n{\n    public function __invoke(Client $client, StatEventBuilder $statEventBuilder)\n    {\n        $userId = auth()-\u003euser()-\u003eid;\n        //sending button_click event as button_click+1\n        $client-\u003estatistics()-\u003esendEvent(\n            $eventBuilder\n                -\u003eincremental()\n                -\u003eevent('button_click')\n                -\u003esetUserId($userId)\n                -\u003ebuild()\n        );\n        \n        //sending purchase event with purchase amount (+30)\n        $client-\u003estatistics()-\u003esendEvent(\n            $eventBuilder\n                -\u003esummarize()\n                -\u003eevent('purchase')\n                -\u003esetValue(30)\n                -\u003esetUserId($userId)\n                -\u003ebuild()\n        );\n    }\n}\n```\n\nFor additional details of sending events please see StatEventBuilder class.\n\n\n### Managing UI\n\nYou can create an experiment/feature flags and set up statistics and get your token and id of experiment on [ABRouter](https://abrouter.com) or just read the [docs](https://abrouter.com/en/docs). \n\n\n## Example\nYou can get an dockerized usage example by the following link: (https://github.com/abrouter/laravel-example)\n\n## :wrench: Contributing\n\nPlease feel free to fork and sending Pull Requests. This project follows [Semantic Versioning 2](http://semver.org) and [PSR-2](http://www.php-fig.org/psr/psr-2/).\n\n## :page_facing_up: License\n\nGPL3. Please see [License File](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabrouter%2Flaravel-abtest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabrouter%2Flaravel-abtest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabrouter%2Flaravel-abtest/lists"}