PHPackages                             joe-pritchard/laravel-twitter-text-formatter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. joe-pritchard/laravel-twitter-text-formatter

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

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

1.0.0(7y ago)0715GPL-3.0PHPPHP ^7.0

Since Jul 9Pushed 7y ago1 watchersCompare

[ Source](https://github.com/joe-pritchard/laravel-twitter-text-formatter)[ Packagist](https://packagist.org/packages/joe-pritchard/laravel-twitter-text-formatter)[ Docs](https://github.com/joe-pritchard/laravel-twitter-text-formatter)[ RSS](/packages/joe-pritchard-laravel-twitter-text-formatter/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Laravel Twitter Text Formatter
==============================

[](#laravel-twitter-text-formatter)

A simple wrapper based on [this code](https://github.com/netgloo/php-samples/tree/master/php-twitter-text-formatter), 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.

Installation
------------

[](#installation)

`composer require joe-pritchard/laravel-twitter-text-formatter`

Configuration
-------------

[](#configuration)

To override the default display templates, publish and modify the config file:

`php artisan vendor:publish --provider=JoePritchard\\LaravelTwitterTextFormatter\\Providers\\ServiceProvider`

The following config options can be then changed ne changed in `config/twitter-formatter.php`:

- *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 ` Retweeted by {{user_name}}`)
- *hashtag\_link\_template* (defaults to `#{{hashtag_text}}`)
- *url\_link\_template* (defaults to `{{url_text}}`)
- *user\_mention\_link\_template* (defaults to `@{{user_mention_text}}`)
- *media\_link\_template* (defaults to `{{media_text}}`)

Usage
-----

[](#usage)

### In Controllers/Classes

[](#in-controllersclasses)

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](http://blog.netgloo.com/2015/08/16/php-getting-latest-tweets-and-displaying-them-in-html/), which is where I first encountered Andrea Zanelli's work before deciding to roll it into this package.

### In Views

[](#in-views)

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

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2913d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/48ef2adcffc130aeda08bc85270619627240c6aacfea079abb2a0461cd0c3c07?d=identicon)[joe-pritchard](/maintainers/joe-pritchard)

---

Top Contributors

[![joe-pritchard](https://avatars.githubusercontent.com/u/25373032?v=4)](https://github.com/joe-pritchard "joe-pritchard (7 commits)")

---

Tags

formatterhtmllaravellaravel-5-packagetwitter-apiformatterparserhtmltwitterlaravel-5-package

### Embed Badge

![Health badge](/badges/joe-pritchard-laravel-twitter-text-formatter/health.svg)

```
[![Health](https://phpackages.com/badges/joe-pritchard-laravel-twitter-text-formatter/health.svg)](https://phpackages.com/packages/joe-pritchard-laravel-twitter-text-formatter)
```

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k260.4M296](/packages/masterminds-html5)[paquettg/php-html-parser

An HTML DOM parser. It allows you to manipulate HTML. Find tags on an HTML page with selectors just like jQuery.

2.4k8.1M128](/packages/paquettg-php-html-parser)[sunra/php-simple-html-dom-parser

Composer adaptation of: A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way! Require PHP 5+. Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.

1.3k9.6M64](/packages/sunra-php-simple-html-dom-parser)[imangazaliev/didom

Simple and fast HTML parser

2.2k2.4M70](/packages/imangazaliev-didom)[simplehtmldom/simplehtmldom

A fast, simple and reliable HTML document parser for PHP.

1891.3M15](/packages/simplehtmldom-simplehtmldom)[scotteh/php-dom-wrapper

Simple DOM wrapper to select nodes using either CSS or XPath expressions and manipulate results quickly and easily.

1482.0M11](/packages/scotteh-php-dom-wrapper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
