1. Go to this page and download the library: Download tecnodesignc/adsense-module library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
...
// import classes needed to create your own instance
use Modules\Adsense\Entities\Space;
use Modules\Adsense\Entities\Ad;
class HomepageController {
...
/**
* controller method
*/
public function displayHomepage()
{
// make a new Space instance
$mySpace = new Space;
$mySpace ->system_name = 'custom_space';
// create ad 1
$ad1 = new Ad;
$ad1->title = 'First Ad';
$ad1->caption = 'First ad text';
$ad1->external_image_url = 'https://placeholdit.imgix.net/~text?txtsize=33&txt=Ad1&w=800&h=300';
// create ad 2
$ad2 = new Ad;
$ad2->title = 'Second Ad';
$ad2->caption = 'Second ad text';
$ad2->external_image_url = 'https://placeholdit.imgix.net/~text?txtsize=33&txt=Ad2&w=800&h=300';
// add ads to space
$mySpace->ads->add($ad1);
$mySpace->ads->add($ad2);
// render view
return View::make('homepage')
->with('mySpace', $mySpace);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.