2017 © Pedro Peláez
 

library laravel-twitter-text-formatter

A wrapper package around a text formatter which takes output from twitter's API and returns an HTML string of the full tweet

image

joe-pritchard/laravel-twitter-text-formatter

A wrapper package around a text formatter which takes output from twitter's API and returns an HTML string of the full tweet

  • Monday, July 9, 2018
  • by joe-pritchard
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel Twitter Text Formatter

A simple wrapper based on this code, providing a service provider, a config file, and a class you can inject into your controllers. For me this is a more friendly way to include the work in my projects., (*1)

Installation

composer require joe-pritchard/laravel-twitter-text-formatter, (*2)

Configuration

To override the default display templates, publish and modify the config file:, (*3)

php artisan vendor:publish --provider=JoePritchard\\LaravelTwitterTextFormatter\\Providers\\ServiceProvider, (*4)

The following config options can be then changed ne changed in config/twitter-formatter.php:, (*5)

  • _show_retweeted_by_ (Control whether or not to show the "retweeted by..." text below retweets that appear in your timeline. Defaults to true)
  • _retweeted_by_template_ (The template that should be used to display the "retweeted by..." section. Defaults to <em> Retweeted by {{user_name}}</em>)
  • _hashtag_link_template_ (defaults to <a href="{{hashtag_link}}" rel="nofollow" target="_blank">#{{hashtag_text}}</a>)
  • _url_link_template_ (defaults to <a href="{{url_link}}" rel="nofollow" target="_blank" title="{{url_title}}">{{url_text}}</a>)
  • _user_mention_link_template_ (defaults to <a href="{{user_mention_link}}" rel="nofollow" target="_blank" title="{{user_mention_title}}">@{{user_mention_text}}</a>)
  • _media_link_template_ (defaults to <a href="{{media_link}}" rel="nofollow" target="_blank" title="{{media_title}}">{{media_text}}</a>)

Usage

In Controllers/Classes

Just call JoePritchard\TwitterTextFormatter\Formatter::format() on the tweet you'd like to format. The format method takes one argument, which is a tweet as returned by the twitter API. For more details on how to retrieve that, head to the official API docs or take a look at this article, which is where I first encountered Andrea Zanelli's work before deciding to roll it into this package., (*6)

In Views

In blade files etc it may be more convenient to use the helper method: {!! twitter_format($tweet) !!}, (*7)

The Versions

09/07 2018

dev-master

9999999-dev https://github.com/joe-pritchard/laravel-twitter-text-formatter

A wrapper package around a text formatter which takes output from twitter's API and returns an HTML string of the full tweet

  Sources   Download

GPL-3.0

The Requires

 

parser html formatter twitter laravel-5-package

09/07 2018

1.0.0

1.0.0.0 https://github.com/joe-pritchard/laravel-twitter-text-formatter

A wrapper package around a text formatter which takes output from twitter's API and returns an HTML string of the full tweet

  Sources   Download

GPL-3.0

The Requires

 

parser html formatter twitter laravel-5-package