Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mastergalen/adsense-ads
Package for easily including Adsense Ad units in Laravel.
https://github.com/mastergalen/adsense-ads
adsense composer laravel package php
Last synced: 24 days ago
JSON representation
Package for easily including Adsense Ad units in Laravel.
- Host: GitHub
- URL: https://github.com/mastergalen/adsense-ads
- Owner: Mastergalen
- License: mit
- Created: 2015-07-01T12:27:09.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-04-30T13:58:01.000Z (over 1 year ago)
- Last Synced: 2024-10-12T22:42:27.217Z (24 days ago)
- Topics: adsense, composer, laravel, package, php
- Language: PHP
- Homepage: https://packagist.org/packages/mastergalen/adsense-ads
- Size: 11.7 KB
- Stars: 11
- Watchers: 3
- Forks: 16
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Adsense Ads for Laravel 5
[![License](https://poser.pugx.org/mastergalen/adsense-ads/license)](https://packagist.org/packages/mastergalen/adsense-ads)
[![Latest Stable Version](https://poser.pugx.org/mastergalen/adsense-ads/v/stable)](https://packagist.org/packages/mastergalen/adsense-ads)
[![Total Downloads](https://poser.pugx.org/mastergalen/adsense-ads/downloads)](https://packagist.org/packages/mastergalen/adsense-ads)Package for easily including Adsense Ad units in Laravel 5.
## Installation
In your project root run
```
composer require mastergalen/adsense-ads
```### Set up config file
Run `php artisan config:publish mastergalen/adsense-ads`.
Edit the generated config file in `/config/ads.php` to add your ad units
```php
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'
]
]
];
```### Register the package with Laravel
Add the provider to the `providers` array in your `config/app.php` file:
```php
Mastergalen\AdsenseAds\AdsServiceProvider::class,
```Register an alias:
```php
'Ads' => Mastergalen\AdsenseAds\AdsFacade::class,
```## Usage
To show ads in your blade templates simply use `{!! Ads::show('responsive') !!}` , for example.