Skip to content

configcat-labs/ab-testing-in-php-sample

Repository files navigation

A/B testing in PHP sample

A companion repo for "How to A/B test new features in PHP using Feature Flags and Amplitude

How it works

This sample PHP app uses the Laravel framework and its default Blade templating engine on the frontend. It is a demo e-commerce website page showing a list of products. It is used to demonstrate how to conduct an A/B test experiment by comparing how well the variation state (Shown on the right) performs compared to the control state (Shown on the left). The aim of the test is to determine if showing the price of the product would increase the number of clicks on the View More button. See the screenshot below.

Screenshot of the A/B difference

How it works

Clicking on the View More button under the product logs an event to Amplitude. These events are then recorded in an analysis chart for later comparison to the benchmark metrics collected for the control state.

Build and Run

Software requirements

  • Composer version 2 - a tool for managing dependencies in PHP
  • Node version 16+
  • NPM version 8+ - a package manager for setting up and building the frontend
  • PHP

How to run this app

1. Clone the this repository.

2. Run the following command to install the PHP's dependencies.

composer install

3. Compile the frontend with NPM using the following command.

npm run dev

4. Start the PHP server with this command:

php artisan serve

You should now be able to see the app by visiting http://127.0.0.1:8000/.

Learn more

Useful links to technical resources.

ConfigCat also supports many other frameworks and languages. Check out the full list of supported SDKs here

You can also explore other code samples for various languages, frameworks, and topics here in the ConfigCat labs on GitHub.

Keep up with ConfigCat on Twitter, Facebook, LinkedIn, and GitHub.

Author

Chavez Harris

Contributions

Contributions are welcome!

About

How to implement A/B testing in PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published