PHPackages                             adumskis/laravel-advert - 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. adumskis/laravel-advert

ActiveLibrary

adumskis/laravel-advert
=======================

Advertising helper for laravel

4817.3k↓100%24[1 issues](https://github.com/adumskis/laravel-advert/issues)PHP

Since Oct 23Pushed 4y ago8 watchersCompare

[ Source](https://github.com/adumskis/laravel-advert)[ Packagist](https://packagist.org/packages/adumskis/laravel-advert)[ RSS](/packages/adumskis-laravel-advert/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Advert
==============

[](#laravel-advert)

Simple package that helps add advert to Laravel 5 websites. What is more it allows to see every advert clicks and views count for some statistics.

### Installation

[](#installation)

First require package with composer:

```
$ composer require adumskis/laravel-advert dev-master
```

Then add service provider to config/app.php:

> Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider

```
'providers' => [
    ...
    Adumskis\LaravelAdvert\AdvertServiceProvider::class,
],
```

Facade to aliases:

```
'aliases' => [
    ...
    'AdvMng'    => Adumskis\LaravelAdvert\AdvertFacade::class,
],
```

Publish config:

```
$ php artisan vendor:publish --provider="Adumskis\LaravelAdvert\AdvertServiceProvider" --tag=config
```

Publish Advert view:

```
$ php artisan vendor:publish --provider="Adumskis\LaravelAdvert\AdvertServiceProvider" --tag=views
```

Lastly publish the migrations if you want to edit them and migrate

```
$ php artisan vendor:publish --provider="Adumskis\LaravelAdvert\AdvertServiceProvider" --tag=migrations
$ php artisan migrate
```

### AdvertCategory model

[](#advertcategory-model)

Simple Eloquent model with variables:

- type - (string) used for getting advert in specific category
- width - (int) size in pixel to resize advert
- height - (int) same as width

If width or height is set to 0 then advert image will be resized with \[aspectRatio\]\[1\] method.

### Advert model

[](#advert-model)

Eloquent model, variables:

- alt - (string) ![]() alt parameter tag
- url - (string) url address where advert should redirect on click
- image\_url - (string) url addres of advert image
- image\_path - (string) path to image (from base path)
- views - (int) count of views
- clicks - (int) count of clicks
- active - (bool) advert state
- advert\_category\_id - (int) advert category model id
- viewed\_at - (timestamp) datetime of last advert view

Advert model has make method that helps to create new record in database also handles image resize and storing stuff. Method requires array with advert variables values and UploadedFile object. Simple example:

```
Advert::make(
    $request->only(['alt', 'url', 'active']),
    $request->file('image')
);
```

It will return Advert object

### Usage in view

[](#usage-in-view)

```
    {{ AdvMng::getHTML('type') }}
```

It will take the that with lowest viewed\_at parameter. getHTML method allow add second (bool) parameter and if it's true then it will not check if advert was already taken.

```
    {{ AdvMng::getHTML('type', true) }}
```

### Advert image storage

[](#advert-image-storage)

```
    'default_file_system' => 'public',
```

To use the inbuilt ability of laravels multiple filesystems change this to another public facing service provider such as s3.

### ToDo/Ideas

[](#todoideas)

- Add limit to advert views/clicks
- Advert Campaigns
- Advert Cost per click and cost per view?
- Video Adverts.
- Time of day adverts
- Multiple adverts per campaign
- Multiple images / videos per advert.
- Follow Ad galley guide and create different size ads for different regions of the page.

###  Health Score

31

↑

LowBetter than 71% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9538660f4b3175bb48da21fa7b4bf48a94ccd55f8c8c4b54a1c957eb9977df55?d=identicon)[adumskis](/maintainers/adumskis)

---

Top Contributors

[![adumskis](https://avatars.githubusercontent.com/u/3788530?v=4)](https://github.com/adumskis "adumskis (19 commits)")

---

Tags

advertadvertisingcountinglaravel

### Embed Badge

![Health badge](/badges/adumskis-laravel-advert/health.svg)

```
[![Health](https://phpackages.com/badges/adumskis-laravel-advert/health.svg)](https://phpackages.com/packages/adumskis-laravel-advert)
```

PHPackages © 2026

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