statamic/twitter

There is no license information available for the latest version (dev-master) of this package.

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 7

Forks: 2

Open Issues: 0

Language:JavaScript

Type:statamic-addon

dev-master 2019-03-14 20:25 UTC

This package is auto-updated.

Last update: 2024-12-15 09:16:36 UTC


README

A fieldtype for Statamic v3

Installation

composer require statamic/twitter
php artisan vendor:publish --provider="Statamic\Twitter\ServiceProvider"

Adding API Keys

This addon uses the Jonathan Thuau's Twitter package under the hood. You will need to create a Twitter app and hook your API keys.

Once you've made your app, add the following to your .env file and enter the values:

TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
TWITTER_ACCESS_TOKEN=
TWITTER_ACCESS_TOKEN_SECRET=

Fieldtype

Use the twitter fieldtype to select tweets from a given user.

fields:
  -
    handle: tweets
    field:
      type: twitter
      max_items: 3
      screen_name: jason_varga

The fieldtype will save a list of tweet status IDs.

tweets:
  - 12345
  - 67890

Templating

The saved tweet IDs will be automatically augmented to useful data. Just use an array syntax to loop over them.

{{ tweets }}
    <blockquote>
        <p>{{ text }}</p>
        <p>– {{ user }}</p>
    </blockquote>
{{ /tweets }}