Package Data | |
---|---|
Maintainer Username: | ardyn |
Maintainer Contact: | shawnsolinko@gmail.com (Shawn Solinko) |
Package Create Date: | 2014-06-22 |
Package Last Update: | 2017-02-05 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-26 15:22:38 |
Package Statistics | |
---|---|
Total Downloads: | 1,630 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 4 |
Total Watchers: | 3 |
Total Forks: | 1 |
Total Open Issues: | 0 |
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.
Install via composer. Publish configuration files. Add your ads.
Edit your composer.json
file:
"require": {
"ardyn/adsense": "~2.0"
}
Run composer update
.
Run php artisan vendor:publish
, then modify the contents of /config/adsense.php
.
return [
'ads' => [
'example' => [
'id' => '123456789',
'size' => [ 300, 100 ],
'description' => 'Test Ad',
'type' => Ad::CONTENT,
],
],
];
Refer to adsense.php
for more configuration documentation.
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'
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.