PHP code example of ripaclub / zf2-hanger-snippet

1. Go to this page and download the library: Download ripaclub/zf2-hanger-snippet 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/ */

    

ripaclub / zf2-hanger-snippet example snippets


 echo $this->hangerSnippet(); 

 echo $this->hangerSnippet()->render('placementName'); 

return [
    'hanger_snippet' => [
        'enable_all' => true, //if not specified true by default
        'snippets' => [
            'snippet-name' => [
                'config_key'  => '', // Config node in the global config, if any, retrivied data will be merged with values then passed to the template
                'template'    => '', // Template script path, if not specified 'hanger-snippet/snippet-name' will be used
                'placement'   => '', // Placement identifier, if not specified the default placement will be used
                'enabled'     => true, // When not specified 'enable_all' value will be used
                'values' => [
                    // Other values for the template
                ],
            ],
        ],
    ],
];

'modules' => [
        // ...
        'HangerSnippet',
        'Application',
],

return [
    'ga' => [
        'monitoring_id' => 'UA-XXXXXXXX-X',
        'domain'        => 'yourdomain.com',
        'anonymize_ip'  => false, // refer to https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced#anonymizeip for more information
        'options' => [
            'siteSpeedSampleRate' => 1,
            'sampleRate' => 100
            // refer to https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference for more options
        ],
    ],

    'hanger_snippet' => [
        'snippets' => [
            'google-analytics' => [
                'config_key' => 'ga', // the config node in the global config, if any
                'values' => [
                    // other values for the template
                ],
            ],
        ],
    ],
];

return [
    'facebook' => [
           'appId' => '...',
    ],

    'hanger_snippet' => [
        'snippets' => [
            'facebook-sdk' => [
                'config_key' => 'facebook', // the config node in the global config, if any
                'values' => [
                    'async' => false,
                    'status' => true,
                    'xfbml'  => true,
                    'version' => 'v2.2',
                ],
            ],
        ],
    ],
];

return [
    'grecaptcha2.0' => [
        'uri' => 'https://www.google.com/recaptcha/api.js'
        // Optional API parameters - see https://developers.google.com/recaptcha/docs/display
        'parameters' => [
            'render' => 'onload',
            // 'hl' => '...',
            // 'onload' => '...',
        ],
    ],
    
    'hanger_snippet' => [
        'snippets' => [
            'google-nocaptcha-recaptcha' => [
                'config_key' => 'grecaptcha2.0', // the config node in the global config, if any
                'values' => [
                    'sitekey' => '',
                    // Optional configurations - see https://developers.google.com/recaptcha/docs/display
                    'theme' => 'light',
                    'type' => 'image',
                    'callback' => '...',
                    'expiredCallback' => '...'
                ],
            ],
        ],
    ],
];

 echo $this->hangerSnippet()->render('google-nocaptcha-recaptcha');