PHP code example of mpalourdio / zf2-twitter-widget

1. Go to this page and download the library: Download mpalourdio/zf2-twitter-widget 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/ */

    

mpalourdio / zf2-twitter-widget example snippets


echo $this->tw(
        [
            'dataWidgetId' => '1245687955000', => the id must be a string (quotes), because of long integer converted to float
            'href'         => 'https://twitter.com/NickName',
            'hrefText'     => 'Here type a title'
        ],
        true/false (true is default)
    );

'class'           => 'A css class, by default it will be twitter-timeline',
'href'            => 'The link to the timeline',
'hrefText'        => 'A title for your timeline to display',
'dataWidgetId'    => 'Your data widget ID : must be a string (!)',
'dataTheme'       => 'ex: dark',
'dataLinkColor'   => 'ex: #cc0000',
'width'           => 300 (integer),
'height'          => 400 (integer),
'dataChrome'      => 'noheader nofooter noborders noscrollbar transparent', => a string with options separated by a single space
'dataBorderColor' => 'border color used by the widget',
'language'        => 'The widget language detected from the page, based on the HTML lang attribute of your content. You can also set the HTML lang attribute on the embed code itself.',
'dataTweetLimit'  => 20,
'dataRelated'     => 'benward,endform',
'dataAriaPolite'  => 'polite or assertive',

$options = new TwitterWidgets\Options\WidgetOptions();
$options->setDataWidgetId('1245687955000');
$options->setHref('https://twitter.com/NickName');
$options->setHrefText('Here type a title');
echo $this->tw($options);

$this->inlineScript()->captureStart();
echo $this->twJS();
$this->inlineScript()->captureEnd();