An open API service indexing awesome lists of open source software.

https://github.com/decodelabs/chirp

Tweet tools for PHP
https://github.com/decodelabs/chirp

parser php tweet

Last synced: 3 months ago
JSON representation

Tweet tools for PHP

Awesome Lists containing this project

README

          

# Chirp

[![PHP from Packagist](https://img.shields.io/packagist/php-v/decodelabs/chirp?style=flat)](https://packagist.org/packages/decodelabs/chirp)
[![Latest Version](https://img.shields.io/packagist/v/decodelabs/chirp.svg?style=flat)](https://packagist.org/packages/decodelabs/chirp)
[![Total Downloads](https://img.shields.io/packagist/dt/decodelabs/chirp.svg?style=flat)](https://packagist.org/packages/decodelabs/chirp)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/decodelabs/chirp/integrate.yml?branch=develop)](https://github.com/decodelabs/chirp/actions/workflows/integrate.yml)
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-44CC11.svg?longCache=true&style=flat)](https://github.com/phpstan/phpstan)
[![License](https://img.shields.io/packagist/l/decodelabs/chirp?style=flat)](https://packagist.org/packages/decodelabs/chirp)

### Twitter tools for PHP

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

---

## Installation

This package requires PHP 8.4 or higher.

Install via Composer:

```bash
composer require decodelabs/chirp
```

## Usage

Parse a tweet into HTML:

```php
use DecodeLabs\Chirp\Parser;

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

### Metamorph

Chirp also provides a [Metamorph](https://github.com/decodelabs/metamorph/) Handler so that it can be used via its simplified interface:

```php
use DecodeLabs\Metamorph;

echo Metamorph::tweet($myTweet);
```

## Output

The parsed HTML provided by Chirp is now wrapped in a `Markup` interface from the [Tagged](https://github.com/decodelabs/tagged/) library such that output is handled correctly in all rendering contexts.

## Licensing
Chirp is licensed under the MIT License. See [LICENSE](./LICENSE) for the full license text.