Package Data | |
---|---|
Maintainer Username: | Mastergalen |
Maintainer Contact: | Mastergalen@users.noreply.github.com (Galen Han) |
Package Create Date: | 2015-07-01 |
Package Last Update: | 2023-04-30 |
Home Page: | https://packagist.org/packages/mastergalen/adsense-ads |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-26 15:24:56 |
Package Statistics | |
---|---|
Total Downloads: | 11,206 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 11 |
Total Watchers: | 3 |
Total Forks: | 16 |
Total Open Issues: | 2 |
Package for easily including Adsense Ad units in Laravel 5.
In your project root run
composer require mastergalen/adsense-ads
Run php artisan config:publish mastergalen/adsense-ads
.
Edit the generated config file in /config/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'
]
]
];
Add the provider to the providers
array in your config/app.php
file:
Mastergalen\AdsenseAds\AdsServiceProvider::class,
Register an alias:
'Ads' => Mastergalen\AdsenseAds\AdsFacade::class,
To show ads in your blade templates simply use {!! Ads::show('responsive') !!}
, for example.