{"id":37003299,"url":"https://github.com/martinbutt/laravel-adsense","last_synced_at":"2026-01-14T00:32:49.241Z","repository":{"id":52657599,"uuid":"359045604","full_name":"martinbutt/laravel-adsense","owner":"martinbutt","description":"Package for easily including Google Adsense Ad units in Laravel.","archived":false,"fork":true,"pushed_at":"2021-08-20T21:58:10.000Z","size":80,"stargazers_count":10,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-22T01:09:44.462Z","etag":null,"topics":["adsense","laravel","php"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/martinbutt/laravel-adsense","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"BoGnY/laravel-adsense","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinbutt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-18T04:42:18.000Z","updated_at":"2025-03-25T15:30:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/martinbutt/laravel-adsense","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/martinbutt/laravel-adsense","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinbutt%2Flaravel-adsense","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinbutt%2Flaravel-adsense/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinbutt%2Flaravel-adsense/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinbutt%2Flaravel-adsense/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinbutt","download_url":"https://codeload.github.com/martinbutt/laravel-adsense/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinbutt%2Flaravel-adsense/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406507,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adsense","laravel","php"],"created_at":"2026-01-14T00:32:48.511Z","updated_at":"2026-01-14T00:32:49.228Z","avatar_url":"https://github.com/martinbutt.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Adsense Ads for Laravel 6.x, 7.x and 8.x\n\n[![Latest Version][ico-version]][link-packagist]\n[![Total Downloads][ico-downloads]][link-downloads]\n[![Build Status][ico-travis]][link-travis]\n[![StyleCI][ico-styleci]][link-styleci]\n[![Scrutinizer][ico-scrutinizer]][link-scrutinizer]\n[![Code Coverage][ico-coverage]][link-coverage]\n[![License][ico-license]][link-license]\n\nPackage for easily including Google Adsense Ad units in [Laravel 6.x, 7.x and 8.x][link-laravel] and [Lumen][link-lumen]. For use with Laravel 5.x use original [Mastergalen/Adsense-Ads package][link-mastergalen-adsense].\n\n## Installation\n\n### 1 - Dependency\n\nIn your project root run\n\nThe first step is using [Composer][link-composer] to install the package and automatically update your `composer.json` file, you can do this by running:\n\n```shell\ncomposer require martinbutt/laravel-adsense\n```\n\n### 2 - Set up config file\n\nRun `php artisan config:publish martinbutt/laravel-adsense`.\n\nEdit the generated config file in `/config/adsense.php` to add your ad units\n\n```php\nreturn [\n    'client_id' =\u003e 'YOUR_CLIENT_ID', //Your Adsense client ID e.g. ca-pub-9508939161510421\n    'ads' =\u003e [\n        'responsive' =\u003e [\n            'ad_slot' =\u003e 1111111111,\n            'ad_format' =\u003e 'fluid',\n            'ad_full_width_responsive' =\u003e true,\n            'ad_style' =\u003e 'display:inline-block'\n        ],\n        'rectangle' =\u003e [\n            'ad_slot' =\u003e 2222222222,\n            'ad_style' =\u003e 'display:inline-block;width:300px;height:250px',\n            'ad_full_width_responsive' =\u003e false,\n            'ad_format' =\u003e 'auto'\n        ]\n    ]\n];\n```\n\n### 3 - Register the provider with Laravel\n\nYou 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:\n\n\u003e `config/app.php`\n\n```php\n\u003c?php\n\nreturn [\n    // ...\n    'providers' =\u003e [\n        MartinButt\\Laravel\\Adsense\\Providers\\AdsenseServiceProvider::class,\n        // ...\n    ],\n    // ...\n];\n```\n\n#### Lumen\n\nGo to `bootstrap/app.php` file and add this line:\n\n```php\n\u003c?php\n// ...\n\n$app = new Laravel\\Lumen\\Application(\n    dirname(__DIR__)\n);\n\n// ...\n\n$app-\u003eregister(MartinButt\\Laravel\\Adsense\\Providers\\AdsenseServiceProvider::class);\n\n// ...\n\nreturn $app;\n```\n\n### 4 - Register the alias with Laravel\n\n\u003e Note: facades are not supported in Lumen.\n\nYou may get access to the Google Adsense Ads services using following facades:\n\n- `MartinButt\\Laravel\\Adsense\\Facades\\AdsenseFacade`\n\nYou can setup a short-version aliases for these facades in your `config/app.php` file. For example:\n\n```php\n\u003c?php\n\nreturn [\n    // ...\n    'aliases' =\u003e [\n        'Adsense' =\u003e MartinButt\\Laravel\\Adsense\\Facades\\AdsenseFacade::class,\n        // ...\n    ],\n    // ...\n];\n```\n\n### 5 - Configuration\n\n#### Publish config\n\nIn your terminal type\n\n```shell\nphp artisan vendor:publish\n```\n\nor\n\n```shell\nphp artisan vendor:publish --provider=\"MartinButt\\Laravel\\Adsense\\Providers\\AdsenseServiceProvider\"\n```\n\n\u003e Lumen does not support this command, for it you should copy the file `src/resources/config/adsense.php` to `config/adsense.php` of your project.\n\nIn `adsense.php` configuration file you can determine the properties of the default values and some behaviors.\n\n## Usage\nAdd `{!! Adsense::javascript() !!}` in your `\u003chead\u003e` tag.\n\nTo show ads, add `{!! Adsense::ads('ads_unit') !!}`, where `ads_unit` is one of your ads units in your config file (for example `{!! Adsense::ads('responsive') !!}`).\n\nUse `{!! Adsense::ads('ads_unit') !!}` every time you want to show an ad.\n\n## Changelog\n\nPlease see the [CHANGELOG.md][link-changelog] file for more information on what has changed recently.\n\n## Credits\n\n- [Martin Butt][link-author]\n- [Crypto Technology srl][link-coauthor1]\n- [Luca Bognolo][link-coauthor2]\n- [All Contributors][link-contributors]\n\n## License\n\nThe Google Adsense Ads is open-sourced software licensed under the [MIT license][link-mit-license].  \nPlease see the [LICENSE.md][link-license] file for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/martinbutt/laravel-adsense.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/martinbutt/laravel-adsense.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/martinbutt/laravel-adsense/master.svg?style=flat-square\n[ico-styleci]: https://styleci.io/repos/359045604/shield?style=flat-square\n[ico-scrutinizer]: https://scrutinizer-ci.com/g/martinbutt/laravel-adsense/badges/quality-score.png?b=master\n[ico-coverage]: https://scrutinizer-ci.com/g/martinbutt/laravel-adsense/badges/coverage.png\n[ico-license]: https://img.shields.io/packagist/l/martinbutt/laravel-adsense?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/martinbutt/laravel-adsense\n[link-downloads]: https://packagist.org/packages/martinbutt/laravel-adsense\n[link-travis]: https://travis-ci.com/martinbutt/laravel-adsense\n[link-styleci]: https://styleci.io/repos/359045604\n[link-scrutinizer]: https://scrutinizer-ci.com/g/martinbutt/laravel-adsense/?branch=master\n[link-coverage]: https://scrutinizer-ci.com/g/martinbutt/laravel-adsense\n[link-laravel]: https://laravel.com\n[link-lumen]: https://lumen.laravel.com\n[link-mastergalen-adsense]: https://github.com/Mastergalen/Adsense-Ads\n[link-composer]: https://getcomposer.org\n[link-license]: LICENSE.md\n[link-changelog]: CHANGELOG.md\n[link-author]: https://www.martinbutt.com\n[link-coauthor1]: https://cryptotech.srl\n[link-coauthor2]: https://bogny.eu\n[link-contributors]: ../../contributors\n[link-mit-license]: https://opensource.org/licenses/MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinbutt%2Flaravel-adsense","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinbutt%2Flaravel-adsense","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinbutt%2Flaravel-adsense/lists"}