decodelabs/chirp

Tweet parser

v0.9.1 2024-08-22 01:26 UTC

This package is auto-updated.

Last update: 2024-11-04 21:05:58 UTC


README

PHP from Packagist Latest Version Total Downloads GitHub Workflow Status PHPStan License

Twitter tools for PHP

Chirp currently provides a hand-rolled tweet parser allowing you to render imported tweets on your site without hassle.

Get news and updates on the DecodeLabs blog.

Installation

Install the library via composer:

composer require decodelabs/chirp

Usage

Parse a tweet into HTML:

use DecodeLabs\Chirp\Parser;

$parser = new Parser();
echo $parser->parse($myTweet);

Metamorph

Chirp also provides a Metamorph Handler so that it can be used via its simplified interface:

use DecodeLabs\Metamorph;

echo Metamorph::tweet($myTweet);

Output

The parsed HTML provided by Chirp is now wrapped in a Markup interface from the Tagged library such that output is handled correctly in all rendering contexts.

Licensing

Chirp is licensed under the MIT License. See LICENSE for the full license text.