GithubHelp home page GithubHelp logo

mpalourdio / twitterwidgets Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 33 KB

PHP library that helps rendering twitter embedded timelines

License: MIT License

PHP 100.00%
php twitter-timeline twitter widget twitter-widget

twitterwidgets's Introduction

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight PHP 7.0+ MIT Licensed

TwitterWidgets

PHP library that helps rendering twitter embedded timelines

Requirements

PHP 7.0+ - Only Composer installation supported

Installation

Run the command below to install via Composer

composer require mpalourdio/twitter-widgets

Usage

$widgetOptions = new WidgetOptions($options);
$userTimeline  = new TimelineBuilder($widgetOptions);
echo $userTimeline->renderWidget();

$options can handle these parameters : https://dev.twitter.com/web/embedded-timelines#options

Their PHP equivalent as array keys to use in the $options array are :

'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',

The TimelineBuilder#renderWidget() method accepts a boolean to disable the javascript code added to each widget. Useful if you have more that one widget to avoid JS overhead.

When disabled, to add only once the needed javascript to your HTML code, use OneTimeJsProvider#getOneTimeWidgetJs() just before your </body>

More information here : https://dev.twitter.com/web/javascript/loading

ZF2

A ZF2 view helper is available here : https://github.com/mpalourdio/zf2-twitter-widget

TWIG

A twig extension is available here : https://github.com/mpalourdio/TwitterWidgetBundle

twitterwidgets's People

Contributors

mpalourdio avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.