PHPackages                             gembla/traffic-rotator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. gembla/traffic-rotator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

gembla/traffic-rotator
======================

A micro smartlink and traffic rotator for gambling affiliate marketing

v1.1.1(1mo ago)02↓50%MITPHPPHP &gt;=8.0

Since Jun 28Pushed 1mo agoCompare

[ Source](https://github.com/Gembla/traffic-rotator)[ Packagist](https://packagist.org/packages/gembla/traffic-rotator)[ Docs](https://github.com/Gembla/traffic-rotator)[ RSS](/packages/gembla-traffic-rotator/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

English | [Русский](README.ru.md)

[![Gembla Traffic Rotator Logo](logo.webp)](logo.webp)

 [![Latest Version](https://camo.githubusercontent.com/626f700dde9af67fa32ff60d6b2441b7cb5a15582382108e5ac05bd586bbed08/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67656d626c612f747261666669632d726f7461746f723f7374796c653d666c6174)](https://packagist.org/packages/gembla/traffic-rotator) [![Total Downloads](https://camo.githubusercontent.com/f541ceed9a9f2ed1922d4b5d8ea2ca3bffcfd858eb42ac8d4fd1f9676aff5ba3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67656d626c612f747261666669632d726f7461746f723f7374796c653d666c6174)](https://packagist.org/packages/gembla/traffic-rotator) [![License](https://camo.githubusercontent.com/457e7839b3a1e631d155861835b160d275dd53a809a8bcded4da1b2bc1a39e80/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f67656d626c612f747261666669632d726f7461746f723f7374796c653d666c6174)](https://github.com/Gembla/traffic-rotator/blob/main/LICENSE) [![Telegram](https://camo.githubusercontent.com/7b0f241f21f728eaf89388ebe947f7a306da776bfbe5c2a34b887ef8bf18496b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54656c656772616d2d4368616e6e656c2d626c75653f7374796c653d666c6174266c6f676f3d54656c656772616d)](https://t.me/gembla_info)

🎰 Gambling Traffic Rotator &amp; Micro-Smartlink
================================================

[](#-gambling-traffic-rotator--micro-smartlink)

A simple, fast, and efficient PHP traffic rotator (a lightweight Smartlink / TDS) tailored for affiliates and media buyers in the Gambling vertical.

It allows you to distribute the flow of users (players) across various offers, casinos, or landing pages based on pre-configured weights (probability ratios).

⚡ Features
----------

[](#-features)

- **Flexible Weight Distribution:** No need to strictly match a 100% total. Add any weights (e.g., 20, 50, 70), and the traffic will be proportionally distributed.
- **Advanced Real IP Detection:** Automatically extracts genuine user IP addresses behind **Cloudflare** (`CF-Connecting-IP`), reverse proxies like **Nginx** (`X-Forwarded-For`), or standard environments.
- **Fail-Safe Redirects:** If HTTP headers have already been sent by your framework or server, the library automatically falls back to an HTML/JavaScript redirect instead of crashing.
- **Optional Logging:** Logging is disabled by default. The script will not create unnecessary files or consume disk resources unless you explicitly pass a file path to the class constructor.
- **Availability Check:** Easily check if any offers are loaded before executing logic with the `$rotator->hasOffers()` method.

✅ Requirements
--------------

[](#-requirements)

To run this library, you will need:

- **PHP:** Version `8.0` or higher
- **Composer:** For dependency management

🚀 Quick Start &amp; Testing (No Setup Required)
-----------------------------------------------

[](#-quick-start--testing-no-setup-required)

You can test the rotator locally on your machine right away without downloading any external third-party libraries:

1. Clone this repository.
2. Generate the autoloader by running the following command in your project terminal: ```
    composer dump-autoload
    ```
3. Start the built-in PHP development web server: ```
    php -S localhost:8000
    ```
4. Open `http://localhost:8000` in your browser. The `index.php` script will execute instantly and redirect you to one of the test offers.

📦 Installation
--------------

[](#-installation)

When you are ready to integrate the rotator into your funnel, install the package via Composer:

```
composer require gembla/traffic-rotator
```

💻 Code Usage
------------

[](#-code-usage)

```
