PHPackages                             slotmachine/slotmachine - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. slotmachine/slotmachine

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

slotmachine/slotmachine
=======================

A dynamic page content container for PHP 5.3. Designed to power landing pages and make webpage prototypes

2.1.0(4y ago)83783[8 issues](https://github.com/archfizz/slotmachine/issues)MITPHPPHP &gt;=5.3.3

Since Feb 8Pushed 3y ago2 watchersCompare

[ Source](https://github.com/archfizz/slotmachine)[ Packagist](https://packagist.org/packages/slotmachine/slotmachine)[ Docs](http://github.com/archfizz/slotmachine)[ RSS](/packages/slotmachine-slotmachine/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (23)Used By (0)

SlotMachine - An A-B page testing library
=========================================

[](#slotmachine---an-a-b-page-testing-library)

Each 'slot' on a page can have its content changed by query parameters, allowing for any possible number of permutations of content on the same page.

This is especially useful for marketing and creating landing pages for A-B testing or for prototyping a design of a webpage without cluttering your templates with a bunch of if-statements.

For example, visiting `exmaple.com/page?h=1&b=1` and `exmaple.com/page?h=2&b=2` will give you a page with a different headline and body if we were to assign the following:

```
headline:
    1: Book your test drive
    2: Test drive our new vehicle

body:
    1: Fill in this quick form and one of our representatives will call you back
    2: Request a callback for a 48 hour test drive today
```

Works with PHP 5.3 through PHP 8 and HHVM.

Version 1.0 is fully released, build on top of Pimple 1.0 and Symfony HttpFoundation 2.8.

Version 2.0 provides compatibility with PHP 7+, Symfony HttpFoundation 3+ and Pimple 2+, but still works with older versions of PHP and these packages.

[![Build Status](https://github.com/archfizz/slotmachine/actions/workflows/php.yml/badge.svg?branch=master)](https://github.com/archfizz/slotmachine/actions/workflows/php.yml/badge.svg?branch=master)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/757f9e42ea7214b06ee488696fc73e527d49f47b782beb05691f75dd97d4faef/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6172636866697a7a2f736c6f746d616368696e652f6261646765732f7175616c6974792d73636f72652e706e673f733d34366433393330323034663566396537306566333137323962613439306435373266626332393634)](https://scrutinizer-ci.com/g/archfizz/slotmachine/)

[![Latest Stable Version](https://camo.githubusercontent.com/0cf6cb7e2e28763e9b9617882b28a3c119c76d38ea951fc5fbd55b8d7bca3a73/68747470733a2f2f706f7365722e707567782e6f72672f736c6f746d616368696e652f736c6f746d616368696e652f762f737461626c652e706e67)](https://packagist.org/packages/slotmachine/slotmachine)[![Total Downloads](https://camo.githubusercontent.com/3e57d43b87199e829d7f063c741d650dda34fb8bc507dc424bab283750607519/68747470733a2f2f706f7365722e707567782e6f72672f736c6f746d616368696e652f736c6f746d616368696e652f646f776e6c6f6164732e706e67)](https://packagist.org/packages/slotmachine/slotmachine)[![Latest Unstable Version](https://camo.githubusercontent.com/996e9c7c291c90d3499e059a9eb89c68d5d30b4af6acd6ee961a6dff0c535c7c/68747470733a2f2f706f7365722e707567782e6f72672f736c6f746d616368696e652f736c6f746d616368696e652f762f756e737461626c652e706e67)](https://packagist.org/packages/slotmachine/slotmachine)[![License](https://camo.githubusercontent.com/bce4384ea345e2e5928912852ee4c89626458973b4909fc77b8ce322d21984f2/68747470733a2f2f706f7365722e707567782e6f72672f736c6f746d616368696e652f736c6f746d616368696e652f6c6963656e73652e706e67)](https://packagist.org/packages/slotmachine/slotmachine)

Since November 2012, SlotMachine has been used on several live web pages with tens of thousands of hits a day, mostly landing pages from Facebook ads.

Concept
-------

[](#concept)

For those working in digital marketing, a effective landing page is always required for an advertisement to lead to. This is more effective if the page matches the content and design of the ad. However if one has many ads, many static pages would therefore be required. Sometimes only one feature on the page such as the headline or the border color of a container would want to be different to another page.

SlotMachine is a PHP library that allows for one HTML page to display different variants of content on the fly. These can be defined beforehand or with a query string. (ie. example.com/landingpage?h=2&amp;c=3)

Think of a bus that changes its blinds (assuming they still use blinds instead of a matrix) to display different combinations of what route number its running, what places it passes through and what its destination is. In SlotMachine, that would be three slots.

Basic Usage
-----------

[](#basic-usage)

1. Install with Composer
2. Set up the configuration and data
3. Create your page

```
