Developed with love by KnpLabs Hire us for your project!
15

advertising-bundle

by idmarinas

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

GitHub release
GitHub Release Date
GitHub code size in bytes
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

Quality Gate StatusMaintainability Rating
Bugs
Security Rating
Code Smells
Vulnerabilities

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_provider: 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_provider: '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') }}
BSD 3-Clause License

Copyright (c) 2021, IDMarinas
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  • Added text comment
    By idmarinas, 2 months ago
  • Deleted @coversNothing
    By idmarinas, 2 months ago
  • Add coverage
    By idmarinas, 2 months ago
  • Not ignore phpunit.xml.dist
    By idmarinas, 2 months ago
  • Deleted attr not allowed
    By idmarinas, 2 months ago
  • Initial commit
    By idmarinas, 2 months ago
  • Initial commit
    By idmarinas, 2 months ago
  • Initial commit
    By web-flow, 2 months ago