2017 © Pedro Peláez
 

library adsense

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

image

ardyn/adsense

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

  • Sunday, February 5, 2017
  • by ardyn
  • Repository
  • 2 Watchers
  • 3 Stars
  • 656 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 55 % Grown

The README.md

Display Google AdSense Ads

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

Installation

Install via composer. Publish configuration files. Add your ads., (*2)

Composer

Edit your composer.json file:, (*3)

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

Run composer update., (*4)

Publish Configuration Files

Run php artisan vendor:publish, then modify the contents of /config/adsense.php., (*5)

  • 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., (*6)

Integrate with Laravel 5

Add the following to the providers array in your config/app.php file:, (*7)

'Ardyn\Adsense\AdsenseServiceProvider'

And add the alias in aliases array:, (*8)

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

Usage

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

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., (*10)

TODO

  • Write tests

The Versions

05/02 2017

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

by Shawn Solinko

laravel adsense google ads

05/02 2017

2.0

2.0.0.0

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

  Sources   Download

MIT

The Requires

 

by Shawn Solinko

laravel adsense google ads

05/02 2017

dev-dev

dev-dev

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

  Sources   Download

MIT

The Requires

 

by Shawn Solinko

laravel adsense google ads

07/07 2014

v1.0

1.0.0.0

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

  Sources   Download

MIT

The Requires

 

by Shawn Solinko

laravel adsense google ads