PHP code example of leonardcodep / laravel-adsbygoogle

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

    

leonardcodep / laravel-adsbygoogle example snippets


return [
    'client_id' => 'YOUR_CLIENT_ID', //Your Adsense client ID e.g. ca-pub-9508939161510421
    'ads' => [
        'responsive' => [
            'ad_slot' => 12345678901,
            'ad_format' => 'auto',
            'ad_full_width_responsive' => true
        ],
        'rectangle' => [
            'ad_slot' => 5681560223,
            'ad_style' => 'display:inline-block;width:300px;height:250px',
        ],
        'inArticle' => [
            'ad_layout' => 'in-article',
            'ad_format' => 'fluid',
            'ad_slot' => 5149408889,
            'ad_style' => 'display:block; text-align:center;'
        ]
    ]
];
javascript
     <script>
        (adsbygoogle = window.adsbygoogle || []).push({
            google_ad_client: "CLIENT_ID",
            enable_page_level_ads: true,
            overlays: {bottom: true}
        });
    </script