idmarinas/advertising-bundle

Show network ads in your Symfony App. Come with the Adsense Network and Generic network for add your own network.

Fund package maintenance!
Paypal

Installs: 2 150

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 1

Forks: 0

Open Issues: 1

Type:symfony-bundle

1.7.1 2024-04-18 17:19 UTC

This package is auto-updated.

Last update: 2024-11-18 18:38:53 UTC


README

Quality Gate Status PHP Composer SonarCloud

GitHub release GitHub Release Date GitHub code size in bytes Build in PHP Build in PHP

GitHub issues GitHub pull requests Github commits (since latest release) GitHub commit activity GitHub last commit

GitHub top language GitHub language count

Reliability Rating Bugs Security Rating Vulnerabilities Maintainability Rating Technical Debt Code Smells Coverage Duplicated Lines (%)

PayPal.Me - The safer, easier way to pay online! Liberapay - Donate Twitter

AdvertisingBundle

Show network ads in your Symfony App. Come with the Adsense Network and Generic network for add your own network.

Installation

Composer

composer require idmarinas/advertising-bundle

Usage

Configuration reference:

# config/packages/idm_advertising.yaml

idm_advertising:
    enable: true # Enable/disable advertising bundle. default false
    networks: # Required
        adsense: # Default configuration for AdSense Advertising
            type: adsense
            # service_network: idm_advertising.adsense # Custom service provider, ID of service
            enable: true # Enable/disable advertising provider
            client: null # "data-ad-client" ca-pub-XXXXXXX11XXX9
            banners: # Banners of ads (As many as you need with the same format). Required
                banner_header:
                    style: 'display:block' # style="" tag in <ins>
                    slot: 0 #  "data-ad-slot" Slot ID of Ad block 8XXXXX1
                    format: 'auto' # "data-ad-format" Values: "rectangle", "vertical" or "horizontal"
                    responsive: true # "data-full-width-responsive"
                other_banner:
                    style: 'display:block'
                    slot: 0
                    format: 'auto'
                    responsive: true
        generic: 
            type: generic # Required
            service_network: 'your.service.id' # Required
            banners: # Required
                custom_zone: 
                    config: 'for your custom network banner'

Usage in your templates:

<!-- Code of your template -->
<!-- .... -->

{{ advertising_banner('adsense', 'banner_header') }}

{{ advertising_banner('generic', 'custom_zone') }}

<!-- .... -->
<!-- Code of your template -->

First argument is the network name, and second is name of banner.

For last need print scripts for your banners:

<!-- Before </body> tag -->

<!-- This print all scripts -->
{{ advertising_scripts() }}

<!-- This print scripts for adsense network -->
{{ advertising_scripts('adsense') }}