PHPackages                             lehelmatyus/adspinner - 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. [Image &amp; Media](/categories/media)
4. /
5. lehelmatyus/adspinner

ActiveLibrary[Image &amp; Media](/categories/media)

lehelmatyus/adspinner
=====================

Rotates randomly between a set of images. takes a JSON object as input.

v1.0.4(1y ago)15MITPHPPHP &gt;=7.4

Since Nov 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/lehelmatyus/AdSpinner)[ Packagist](https://packagist.org/packages/lehelmatyus/adspinner)[ RSS](/packages/lehelmatyus-adspinner/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (6)Used By (0)

AdSpinner
=========

[](#adspinner)

Simple PHP library to randomly rotate between ad images (or any linked images).
Displays a new linked image on every page load. It takes a JSON as an input and picks an image randomly from the onoes available

 [![](https://camo.githubusercontent.com/cf94b272727a7e0794f3696738b61fd05d6f0bd5597d230c2ff789bdc179dd1e/68747470733a2f2f63646e2d69636f6e732d706e672e666c617469636f6e2e636f6d2f3132382f323030302f323030303531392e706e67)](https://camo.githubusercontent.com/cf94b272727a7e0794f3696738b61fd05d6f0bd5597d230c2ff789bdc179dd1e/68747470733a2f2f63646e2d69636f6e732d706e672e666c617469636f6e2e636f6d2f3132382f323030302f323030303531392e706e67) Donate BitcoinCash

**BCH Cash**: qrt2r4mryq9xu3sgexq2x98m6aza3s6ug5wt3xd22z
**BTC**: 1PyoztctiBQmonh8UTpvb6ArA1k3jVeWA6

How To add AdSpinner to your php project
----------------------------------------

[](#how-to-add-adspinner-to-your-php-project)

Create a composer.json File: Run the following command to initialize a new composer.json file if you don't already have one.

```
composer init

```

Add AdSpinner as a dependency

```
composer require lehelmatyus/adspinner

```

Verify Composer Installation

```
composer install

```

Usage example
-------------

[](#usage-example)

Includ in your project

```
require_once __DIR__ . '/vendor/autoload.php';

```

Set up JSON for images

```
// Example JSON:
$ads_json = '{
   "ads": [
       {
           "link": "https://example.com/ad1",
           "image": "https://example.com/ad1.jpg",
           "alt": "Ad 1",
           "width": 300,
           "height": 250
       },
       {
           "link": "https://example.com/ad2",
           "image": "https://example.com/ad2.jpg",
           "alt": "Ad 2",
           "width": 728,
           "height": 90
       },
       {
           "link": "https://example.com/ad3",
           "image": "https://example.com/ad3.jpg",
           "alt": "Ad 3",
           "width": 160,
           "height": 600
       }
   ]
}';

```

Start Spinning Images!

```
$ads_json = '{
    "ads": [
        ...
    ]
}';

$ad_spinner = new AdSpinner($ads_json);
echo $ad_spinner->spin();

// print more than one
echo $ad_spinner->spin(2);

```

Spin with a template

```
$templateService = new AdSpinnerTemplateService();
// pass your template string
$templateService->setTemplate('');

$ad_spinner = new AdSpinner($ads_json);
echo "";
echo $ad_spinner->spin(1, $templateService);
echo "";

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance44

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~17 days

Total

5

Last Release

474d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e79fc1defdf314e9be726d22ab0064a2ad69253d291614361aa068e175e32a60?d=identicon)[lehelmatyus](/maintainers/lehelmatyus)

---

Top Contributors

[![lehelmatyus](https://avatars.githubusercontent.com/u/1402112?v=4)](https://github.com/lehelmatyus "lehelmatyus (8 commits)")

### Embed Badge

![Health badge](/badges/lehelmatyus-adspinner/health.svg)

```
[![Health](https://phpackages.com/badges/lehelmatyus-adspinner/health.svg)](https://phpackages.com/packages/lehelmatyus-adspinner)
```

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k22](/packages/bkwld-croppa)[marc1706/fast-image-size

fast-image-size is a PHP library that does almost everything PHP's getimagesize() does but without the large overhead of downloading the complete file.

959.4M20](/packages/marc1706-fast-image-size)[char0n/ffmpeg-php

PHP wrapper for FFmpeg application

495225.1k1](/packages/char0n-ffmpeg-php)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
