PHPackages                             ardyn/adsense - 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. ardyn/adsense

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

ardyn/adsense
=============

A convenient way to include Google AdSense ads within your pages.

2.0(9y ago)41.7k1MITPHPPHP &gt;=5.4.0

Since Jul 7Pushed 9y ago2 watchersCompare

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

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

Display Google AdSense Ads
==========================

[](#display-google-adsense-ads)

A convenient way to display Google AdSense ads in your Laravel 5 application. Just setup your ads, then $adsense-&gt;get('ad') to return the HTML for the ad.

Installation
------------

[](#installation)

Install via composer. Publish configuration files. Add your ads.

### Composer

[](#composer)

Edit your `composer.json` file:

```
"require": {
  "ardyn/adsense": "~2.0"
}
```

Run `composer update`.

### Publish Configuration Files

[](#publish-configuration-files)

Run `php artisan vendor:publish`, then modify the contents of `/config/adsense.php`.

- **id** *required* The ad ID.
- **size** *required* Size of ad. Either an array or string.
- **description** A short description of the ad.
- **type** Either Ad::LINK or Ad::CONTENT. Default is Ad::CONTENT.

```
return [
  'ads' => [
    'example' => [
      'id' => '123456789',
      'size' => [ 300, 100 ],
      'description' => 'Test Ad',
      'type' => Ad::CONTENT,
    ],
  ],
];
```

Refer to `adsense.php` for more configuration documentation.

### Integrate with Laravel 5

[](#integrate-with-laravel-5)

Add the following to the `providers` array in your `config/app.php` file:

```
'Ardyn\Adsense\AdsenseServiceProvider'
```

And add the alias in `aliases` array:

```
'Adsense' => 'Ardyn\Adsense\Facades\Adsense'
```

Usage
-----

[](#usage)

To display the HTML for an ad, call `Adsense::get('example');` where `'example'` is the array index of your ad.

Determine whether ads are displayed by setting the `enabled` configuration value to either a boolean value or a closure that returns a boolean value. The closure may include parameters. Pass the arguments in `Adsense::get('example', [ /* parameters */ ])`. Closures are not recommened as Laravel's config:cache cannot serialize closures correctly.

TODO
----

[](#todo)

- Write tests

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~943 days

Total

2

Last Release

3388d ago

Major Versions

v1.0 → 2.02017-02-05

### Community

Maintainers

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

---

Top Contributors

[![ardyn](https://avatars.githubusercontent.com/u/7873022?v=4)](https://github.com/ardyn "ardyn (10 commits)")

---

Tags

laraveladsensegoogle ads

### Embed Badge

![Health badge](/badges/ardyn-adsense/health.svg)

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

###  Alternatives

[yajra/laravel-datatables-oracle

jQuery DataTables API for Laravel

4.9k33.8M339](/packages/yajra-laravel-datatables-oracle)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[cknow/laravel-money

Laravel Money

1.0k4.3M22](/packages/cknow-laravel-money)[livewire/flux

The official UI component library for Livewire.

9385.0M86](/packages/livewire-flux)[akaunting/laravel-money

Currency formatting and conversion package for Laravel

7825.3M18](/packages/akaunting-laravel-money)[prologue/alerts

Prologue Alerts is a package that handles global site messages.

3486.1M30](/packages/prologue-alerts)

PHPackages © 2026

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