PHPackages                             benkle/deviantart - 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. benkle/deviantart

ActiveLibrary[API Development](/categories/api)

benkle/deviantart
=================

Access to DeviantARTs oAuth2 API

1.0.2(8y ago)026MITPHPPHP ^7.0

Since Oct 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/benkle-libs/deviantart)[ Packagist](https://packagist.org/packages/benkle/deviantart)[ RSS](/packages/benkle-deviantart/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

An basic, thinly object-oriented wrapper for deviantARTs oAuth2 API
===================================================================

[](#an-basic-thinly-object-oriented-wrapper-for-deviantarts-oauth2-api)

This library can be used to access \[\]deviantARTs official oAuth2 API\](), abstracting away authorization, request building and response parsing. Well, a little bit, anyway...

Requirements
------------

[](#requirements)

- PHP 7.0+
- [seinopsys/oauth2-deviantart](https://packagist.org/packages/seinopsys/oauth2-deviantart) 1.0+

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

[](#installation)

The Library can be included in the usual way with composer:

```
    composer require benkle/deviantart
```

Usage
-----

[](#usage)

First you need to create an instance of Seinopsys' oAuth provider for the library to use:

```
use \SeinopSys\OAuth2\Client\Provider\DeviantArtProvider;

$provider = new DeviantArtProvider(
    [
        'clientId'     => 'YOUR ID',
        'clientSecret' => 'YOUR SECRET',
        'redirectUri'  => 'YOUR REDIRECT URL',
    ]
);
```

Next, you need to procure a stored token.

```
// Must return an instance of \League\OAuth2\Client\Token\AccessToken or null
$accessToken = PROCURE_ACCESS_TOKEN();
```

Now you can wrap the `Api` class around them.

```
use \Benkle\Deviantart\Api;

$api = new Api($provider, $accessToken);
```

And finally, Authorization!

```
use \Benkle\Deviantart\Exceptions\UnauthorizedException;

try {
    $scopes = [Api::SCOPE_BROWSE];
    $api->authorize($scopes);
    // authorize() will refresh the token, if necessary, so you might want to write it back to storage.
    // You can access it via $api->getAccessToken()
} catch (UnauthorizedException $e) {
    // Here you can handle the initial user input for authorization.
    // The exception message has been replaced with the URL you need to call, so you can get it easily like this:
    $url = "$e";
}
```

In case you are in the handler called by initial authorization, you can hand the auth code as a second parameter to `authorize`:

```
    $api->authorize($scopes, $authCode);
```

Once you've done all that, you can use the API, e.g. like this:

```
try {
    /** @var \stdClass $result */
    $result = $api->browse()->getNewest();
} catch (ApiException $e) {
    // Handle API exception
}
```

The endpoints are grouped into sub-object in accordance with the documentation and will return instances of `\stdClass`.

The only exception of this rule is the sta.sh submit, which returns the `ApiRequest` used so adding parts is easier:

```
use \Benkle\Deviantart\ApiRequestPart;

try {
    /** @var \stdClass $result */
        $result = $api
            ->stash()
            ->submit('Test', 'A sta.sh test', null, null,true)
            ->addPart(ApiRequestPart::from('test', fopen('/home/bizzl/test.txt', 'r'), 'test.txt'))
            ->send();
} catch (ApiException $e) {
    // Handle API exception
}
```

FAQ
---

[](#faq)

- **Where are the *curated* endpoints?** They are deprecated and you should not use them.
- **Why do so many endpoints have an `$includeMature` parameter?** They are in the Docs. I know that they seem senseless and probably won't work, but they also don't really hurt.
- **All but one endpoint return `\stdClass`. Why?** It's easier to type hint, and I don't need hydrators and entities. The library is after all basic and only thinly object-oriented. Maybe I'll write a more OOP library around this some day.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~14 days

Total

3

Last Release

3109d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/70253fd266a8069896d4d0265ba3d452d6e4a006cbf564a11bfaf692ca5bb44c?d=identicon)[bizzl-greekdog](/maintainers/bizzl-greekdog)

---

Top Contributors

[![bizzl-greekdog](https://avatars.githubusercontent.com/u/424349?v=4)](https://github.com/bizzl-greekdog "bizzl-greekdog (34 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/benkle-deviantart/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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