PHPackages                             crypto-technology/laravel-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. crypto-technology/laravel-adsense

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

crypto-technology/laravel-adsense
=================================

Display Adsense ads easily in Laravel.

v1.2(6y ago)11361[1 issues](https://github.com/crypto-technology/laravel-adsense/issues)[1 PRs](https://github.com/crypto-technology/laravel-adsense/pulls)MITPHPPHP ^7.2

Since Jul 1Pushed 4y agoCompare

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

READMEChangelog (3)Dependencies (4)Versions (11)Used By (0)

Google Adsense Ads for Laravel 6.0+
===================================

[](#google-adsense-ads-for-laravel-60)

[![Latest Version](https://camo.githubusercontent.com/e56c264e5640b174f5b156c56f307b089368b5b8197bbb214c44ec0765b6922c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63727970746f2d746563686e6f6c6f67792f6c61726176656c2d616473656e73652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/crypto-technology/laravel-adsense)[![Total Downloads](https://camo.githubusercontent.com/da78ae25d300a3762f56f22f22b30741e1530edbc52b9bc0b43c3bd1f256e304/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63727970746f2d746563686e6f6c6f67792f6c61726176656c2d616473656e73652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/crypto-technology/laravel-adsense)[![Build Status](https://camo.githubusercontent.com/4aafa0f41ae13a35984916e63ff5e1b586472b42d72b1ac339d6d946a1b30261/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f63727970746f2d746563686e6f6c6f67792f6c61726176656c2d616473656e73652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/crypto-technology/laravel-adsense)[![StyleCI](https://camo.githubusercontent.com/7ebfa4c83891c42d553b995e6381dc388581846e506906a09374d32b28e89d2d/68747470733a2f2f7374796c6563692e696f2f7265706f732f3231313637373336322f736869656c643f7374796c653d666c61742d737175617265)](https://styleci.io/repos/211677362)[![Scrutinizer](https://camo.githubusercontent.com/ace8fdc2fef65fce6f0a1ac063622e1f369d6b834178cdcb3f4ceac366b762a6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63727970746f2d746563686e6f6c6f67792f63727970746f63757272656e63792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/crypto-technology/cryptocurrency/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/b93fa2760ff0da55e4e13ad7acbda949e9f36301da6507699cb28ccc93e224ae/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63727970746f2d746563686e6f6c6f67792f6c61726176656c2d616473656e73652f6261646765732f636f7665726167652e706e67)](https://scrutinizer-ci.com/g/crypto-technology/laravel-adsense)[![License](https://camo.githubusercontent.com/fb858538236363128346de62fddf45010864ed29b7af58c6cbc4603a177615cf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f63727970746f2d746563686e6f6c6f67792f6c61726176656c2d616473656e73653f7374796c653d666c61742d737175617265)](LICENSE.md)

Package for easily including Google Adsense Ad units in [Laravel 6.0+](https://laravel.com) and [Lumen](https://lumen.laravel.com). For use it with Laravel 5.x use original [Mastergalen/Adsense-Ads package](https://github.com/Mastergalen/Adsense-Ads).

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

[](#installation)

### 1 - Dependency

[](#1---dependency)

In your project root run

The first step is using [Composer](https://getcomposer.org) to install the package and automatically update your `composer.json` file, you can do this by running:

```
composer require crypto-technology/laravel-adsense
```

> **Note**: If you are using Laravel 5.5+, the steps 3 and 4, for providers and aliases, are unnecessaries. Google Adsense Ads supports Laravel new [Package Discovery](https://laravel.com/docs/5.5/packages#package-discovery).

### 2 - Set up config file

[](#2---set-up-config-file)

Run `php artisan config:publish crypto-technology/laravel-adsense`.

Edit the generated config file in `/config/adsense-ads.php` to add your ad units

```
return [
    'client_id' => 'YOUR_CLIENT_ID', //Your Adsense client ID e.g. ca-pub-9508939161510421
    'ads' => [
        'responsive' => [
            'ad_unit_id' => 12345678901,
            'ad_format' => 'auto'
        ],
        'rectangle' => [
            'ad_unit_id' => 1234567890,
            'ad_style' => 'display:inline-block;width:300px;height:250px',
            'ad_format' => 'auto'
        ]
    ]
];
```

### 3 - Register the provider with Laravel

[](#3---register-the-provider-with-laravel)

You need to update your application configuration in order to register the package so it can be loaded by Laravel, just update your `config/app.php` file adding the following code at the end of your `'providers'` section:

> `config/app.php`

```
