ardyn/adsense 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ardyn/adsense

Composer 安装命令:

composer require ardyn/adsense

包简介

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

README 文档

README

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.

Installation

Install via composer. Publish configuration files. Add your ads.

Composer

Edit your composer.json file:

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

Run composer update.

Publish Configuration Files

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

  • 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.

Integrate with Laravel 5

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'

Usage

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.

TODO

  • Write tests

统计信息

  • 总下载量: 1.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-06-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固