PHPackages                             cleytonbonamigo/share-twitter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. cleytonbonamigo/share-twitter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cleytonbonamigo/share-twitter
=============================

PHP Client to share a Twitter with Media images

1.0.0(2y ago)04MITPHPPHP ^8.1

Since Jul 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/CleytonBonamigo/share-twitter)[ Packagist](https://packagist.org/packages/cleytonbonamigo/share-twitter)[ RSS](/packages/cleytonbonamigo-share-twitter/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Share Twitter (Post Tweet with Image)
=====================================

[](#share-twitter-post-tweet-with-image)

Combination of API V1 and V2 for PHP with CURL instead of any other libraries, this is a pacjage that provides an easy and fast integration of Twitter.

For now, it's not possible to upload files with API V2, that's why it's a combination of them.

Installation
------------

[](#installation)

First you need to add the component to you composer.json.

```
composer require cleytonbonamigo/twitter-share

```

How to use
----------

[](#how-to-use)

Firstly, you need to follow [this tutorial](https://developer.twitter.com/en/docs/tutorials/getting-started-with-r-and-v2-of-the-twitter-api).

- [Request of an approved account](https://developer.twitter.com/en/apply-for-access);
- Once you have an approved developer account, you will need to [create a Project](https://developer.twitter.com/en/docs/projects/overview);
- Enable read/write access for your Twitter app;
- Generate Consumer Keys and Authentication Tokens;
- Grab your Keys and Tokens from the twitter developer site.

### Prepare settings

[](#prepare-settings)

Settings are expected as below:

```
use CleytonBonamigo\ShareTwitter\Client;

$settings = [
    'access_token' => access_token,
    'access_token' => access_token,
    'access_token_secret' => access_token_secret,
    'consumer_key' => consumer_key,
    'consumer_secret' => consumer_secret
];

$client = new Client($settings);
```

Endpoints
---------

[](#endpoints)

### Media

[](#media)

```
$url = ''; //An URL or path to local file
$return = $client->media()->uploadMediaFromUrl($url);
```

```
$tweet = [
    'text' => 'Text of your tweet :)',
    'media' => [ //This param is optional
        'media_ids' => [
            'media_id_string' //Returned at uploadMediaFromUrl()
        ]
    ]
];

$client->tweet()->create(['text' => 'Test new tweet post with image complete flux', 'media' => ['media_ids' => [$media->media_id_string]]]);
```

Contributing
------------

[](#contributing)

Fork/download the code and run.

`composer install`

Copy `test/config/.env.example` to `test/config/.env` and add your credentials for testing.

### To run tests

[](#to-run-tests)

`./vendor/bin/phpunit` or `composer test`.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1091d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fe9fd0faf7382b634c067a30a5794629f87b521f9e2872fbe50768217f0e99b?d=identicon)[CleytonBonamigo](/maintainers/CleytonBonamigo)

---

Top Contributors

[![CleytonBonamigo](https://avatars.githubusercontent.com/u/1793503?v=4)](https://github.com/CleytonBonamigo "CleytonBonamigo (36 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cleytonbonamigo-share-twitter/health.svg)

```
[![Health](https://phpackages.com/badges/cleytonbonamigo-share-twitter/health.svg)](https://phpackages.com/packages/cleytonbonamigo-share-twitter)
```

###  Alternatives

[optimus/heimdal

122335.3k5](/packages/optimus-heimdal)[b13/host-variants

Extends the base variants condition with current host.

35337.6k5](/packages/b13-host-variants)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
