PHP 8 / Composer Library for Twister
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.0 KiB

11 months ago
# twister-php
11 months ago
11 months ago
PHP 8 / Composer Tools for Twister API
11 months ago
## Install
11 months ago
`composer require twisterarmy/twister`
## Features
### Client
Twister client communication toolkit
### RSS
RSS toolkit for twister
###### Init
```
$rss = new \Twisterarmy\Twister\Rss();
```
#### Format
##### Time
11 months ago
Convert RSS time to datetime format, `U` by default
[Documentation](https://www.php.net/manual/en/datetime.format.php)
11 months ago
###### Example
```
$rss->setTimeFormat('c');
```
##### Message
11 months ago
Convert RSS fields to twister message format, `{title} {link}` by default
11 months ago
###### Mask
11 months ago
* `{time}` - formatted time string by `setTimeFormat`
11 months ago
* `{link}` - target link
* `{title}` - item title
###### Example
```
$rss->setMessageFormat('{title} {link}');
```
#### Length
Twister protocol accept messages with 256 chars max but you can define another value.
Formatted messages greater this value will be skipped from feed.
##### Example
```
$rss->setLength(256);
```
#### Feed
Get formatted feed array
##### Example
```
$feed = $rss->get(url);
```