Download the PHP package nojimage/twitter-text-php without Composer

On this page you can find all versions of the php package nojimage/twitter-text-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

Please rate this library. Is it a good library?

All versions of twitter-text-php with dependencies

Informations about the package twitter-text-php

Twitter Text (PHP Edition)

A library of PHP classes that provide auto-linking and extraction of usernames, lists, hashtags and URLs from tweets. Originally created from twitter-text-rb and twitter-text-java projects by Matt Sanford and ported to PHP by Mike Cochrane, this library has been improved and made more complete by Nick Pope.

Build Status Codecov Latest Stable Version

Requirements

If the necessary extensions are not installed on the server, please install it additionally or use symfony/polyfill.

Install

You can install this library into your application using Composer.

Note for Older Server

This library use intl/libICU. Some older server and PHP 7.2+ combinations may have deprecated warnings due to older ICU versions. refs #32

If you are using RHEL/CentOS 6, installing PHP using the remi repository is the best choice. If you use remi, you can use the new ICU.

Features

Autolink

Extractor

Hit Highlighter

Validation

Parser

Length validation

twitter-text 3.0 updates the config file with emojiParsingEnabled config option. When true, twitter-text-php will parse and discount emoji supported by the Unicode Emoji 11.0 (NOTE: Original twitter-text supported twemoji library). The length of these emoji will be the default weight (200 or two characters) even if they contain multiple code points combined by zero-width joiners. This means that emoji with skin tone and gender modifiers no longer count as more characters than those without such modifiers.

twitter-text 2.0 introduced configuration files that define how Tweets are parsed for length. This allows for backwards compatibility and flexibility going forward. Old-style traditional 140-character parsing is defined by the v1.json configuration file, whereas v2.json is updated for "weighted" Tweets where ranges of Unicode code points can have independent weights aside from the default weight. The sum of all code points, each weighted appropriately, should not exceed the max weighted length.

Some old methods from twitter-text-php 1.0 have been marked deprecated, such as the Twitter\Text\Validator::isValidTweetText(), Twitter\Text\Validator::getTweetLength() method. The new API is based on the following method, Twitter\Text\Parser::parseTweet()

This method takes a string as input and returns a results object that contains information about the string. Twitter\Text\ParseResults object includes:

Examples

For examples, please see tests/example.php which you can view in a browser or run from the command line.

Conformance

You'll need the test data which is in YAML format from the following repository:

https://github.com/twitter/twitter-text

twitter/twitter-text already included in composer.json, so you should just need to run:

curl -s https://getcomposer.org/installer | php
php composer.phar install

There are a couple of options for testing conformance:

Thanks & Contributions

The bulk of this library is from the heroic efforts of:


Version
Requires php Version >=5.3.3
ext-mbstring Version *
ext-intl Version *

The package nojimage/twitter-text-php contains the following files

Loading the files please wait ....