PHP code example of lehelmatyus / adspinner

1. Go to this page and download the library: Download lehelmatyus/adspinner 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/ */

    

lehelmatyus / adspinner example snippets




$ads_json = '{
    "ads": [
        ...
    ]
}';

$ad_spinner = new AdSpinner($ads_json);
echo $ad_spinner->spin();

// print more than one
echo $ad_spinner->spin(2);

$templateService = new AdSpinnerTemplateService();
// pass your template string
$templateService->setTemplate('<a href="%link%" target="_blank"><img src="%image%" alt="%alt%" width="%width%" height="%height%"></a>');

$ad_spinner = new AdSpinner($ads_json);
echo "<div class='adspinner'>";
echo $ad_spinner->spin(1, $templateService);
echo "</div>";