decodelabs/chirp

Tweet parser

v0.8.2 2023-09-26 09:44 UTC

This package is auto-updated.

Last update: 2024-04-26 10:23:29 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.