PHPackages                             eugenecooper/tumblr - 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. [API Development](/categories/api)
4. /
5. eugenecooper/tumblr

ActiveLibrary[API Development](/categories/api)

eugenecooper/tumblr
===================

A unofficial Tumblr API Client for PHP.

0.1.1(6y ago)06MITPHPPHP &gt;=5.5.0

Since Sep 25Pushed 6y agoCompare

[ Source](https://github.com/eugenecooper/tumblr-php)[ Packagist](https://packagist.org/packages/eugenecooper/tumblr)[ Docs](https://github.com/eugenecooper/tumblr-php)[ RSS](/packages/eugenecooper-tumblr/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (3)Versions (6)Used By (0)

PHP Tumblr Client
=================

[](#php-tumblr-client)

[![Build Status](https://camo.githubusercontent.com/7632cfd0fda3a01e217a652e4d48a62b5aa6a433e25826333e9f96e8545d6766/68747470733a2f2f7472617669732d63692e6f72672f6d6174686575736d617269616e6f2f74756d626c722d7068702e737667)](https://travis-ci.org/matheusmariano/tumblr-php)

An unofficial PHP client for the [Tumblr API](https://www.tumblr.com/docs/en/api/v2)

Installing
----------

[](#installing)

Through the [Composer](https://getcomposer.org/), you must require the package `matheusmariano/tumblr`.

Using
-----

[](#using)

```
use MatheusMariano\Tumblr\Client;
use MatheusMariano\Tumblr\Connector\Auth\ApiKey;

$auth = new ApiKey('my-api-key');
$client = new Client($auth);

$object = $client->get('blog/nutright.tumblr.com/posts', [
    'api_key' => true,
    'tag' => 'fruit'
]);
```

### Authentication

[](#authentication)

Before request any method from API, it's necessary to authenticate our client. To do it, there are two authentication levels:

- API key
- OAuth

The API key level is the simplest one, because it just needs the **consumer key** given by the Tumblr when [registering your application](https://www.tumblr.com/oauth/apps). To use this, you should import the `ApiKey` class

```
use MatheusMariano\Tumblr\Connector\Auth\ApiKey;
```

and then instantiate it with your **consumer key**.

```
$auth = new ApiKey('your-consumer-key');
```

You can use the OAuth level practically the same way, importing the `OAuth` class

```
use MatheusMariano\Tumblr\Connector\Auth\OAuth;
```

and then instantiating with all the necessary keys.

```
$auth = new OAuth; // Also accepts ordered parameters.
$auth->consumerKey = '...';
$auth->consumerSecret = '...';
$auth->oauthToken = '...';
$auth->oauthTokenSecret = '...';
```

### OAuth tokens and Authorizer

[](#oauth-tokens-and-authorizer)

Getting the tokens from users is a little bit different task, because they need to be notified and give authorization to your application. It's a proccess that involves a lot of steps, but the `Authorizer` class turns everything easier. For every used page, you should import the class this way.

```
use MatheusMariano\Tumblr\Authorizer;
```

The first step is to send your consumers to Tumblr with your callback URI. Let's consider it should be `https://example.com/auth/tumblr/callback`.

```
$auth = new OAuth;
$auth->consumerKey = '...';
$auth->consumerSecret = '...';

$authorizer = new Authorizer($auth);
$tokens = $authorizer->getTemporaryTokens('https://example.com/auth/tumblr/callback');
```

If consumers are accepted, you should receive temporary tokens.

```
['oauth_token' => '...', 'oauth_token_secret' => '...']
```

Save these tokens, because they are necessary for the next session. Now you need to redirect your users to `https://www.tumblr.com/oauth/authorize?oauth_token={$tokens['oauth_token']}`. There, they are going to be able to authorize your application and then going to be redirected to the callback URI.

In the `https://example.com/auth/tumblr/callback`, the step is to send the consumers and the temporary tokens together with GET parameter `oauth_verifier` received from Tumblr.

```
$auth = new OAuth;
$auth->consumerKey = '...';
$auth->consumerSecret = '...';
$auth->oauthToken = $oauthToken;
$auth->oauthTokenSecret = $oauthTokenSecret;

$authorizer = new Authorizer($auth);
$tokens = $authorizer->getTokens($oauthVerifier);
```

If you prefer, you can use the global `$_GET` to get the `oauth_verifier`.

```
$oauthVerifier = $_GET['oauth_verifier'];
```

If everything runs as plained, you should receive the user definitive tokens.

### Client

[](#client)

After configure one of those authenticators, you can import the `Client` class

```
use MatheusMariano\Tumblr\Client;
```

and then instantiate it with the authenticator.

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

### Methods

[](#methods)

In the version `0.1` of this package, the `Client` has only 2 very basic methods

- `get`
- `post`

It's important to follow the [Tumblr API](https://www.tumblr.com/docs/en/api/v2) to use these methods and your responses correctly.

Example: getting the [text posts](https://www.tumblr.com/docs/en/api/v2#text-posts) that has the `fruit` tag.

```
$object = $client->get('blog/nutright.tumblr.com/posts/text', [
    'api_key' => true,
    'tag' => 'fruit',
]);
```

The response should be an `stdClass` object with all content of `response`, following the [Tumblr API](https://www.tumblr.com/docs/en/api/v2).

```
$object->total_posts; // int
$object->posts; // array
$object->blog; // stdClass
$object->blog->title; // string
```

The `post` method works the same way.

```
$client->post('blog/nutright.tumblr.com/post', [
    'type' => 'text',
    'tags' => 'fruit, apple, red',
    'title' => 'My new post title',
    'body' => 'My new post body...',
]);
```

### Exceptions

[](#exceptions)

Request methods may receive errors, generaly `401 not authorized` and `404 not found`, throwing exceptions like `GuzzleHttp\Exception\ClientException`, `GuzzleHttp\Exception\ServerException` etc., which should be treated with `try...catch`. See the [Guzzle documentation](http://docs.guzzlephp.org/en/latest/quickstart.html#exceptions) for more information.

```
try {
    $client->get('blog/nutright.tumblr.com/followers', ['api_key' => true]);
} catch (\GuzzleHttp\Exception\ClientException $e) {
    // Do something
}
```

License
-------

[](#license)

PHP Tumblr Client a is open-sourced software licensed under the MIT license.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92% 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

Every ~698 days

Total

3

Last Release

2484d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.6.0

v0.2.x-devPHP &gt;=5.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/75191f939aee64e753855a3601c2180ba3d8242fe06139929e1a431c67fd2cda?d=identicon)[eugenecooper](/maintainers/eugenecooper)

---

Top Contributors

[![vitor-mariano](https://avatars.githubusercontent.com/u/2306588?v=4)](https://github.com/vitor-mariano "vitor-mariano (23 commits)")[![eugenecooper](https://avatars.githubusercontent.com/u/8261869?v=4)](https://github.com/eugenecooper "eugenecooper (2 commits)")

---

Tags

apiclienttumblr

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/eugenecooper-tumblr/health.svg)

```
[![Health](https://phpackages.com/badges/eugenecooper-tumblr/health.svg)](https://phpackages.com/packages/eugenecooper-tumblr)
```

###  Alternatives

[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

1243.1k1](/packages/skeeks-yii2-google-api)

PHPackages © 2026

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