deviantArt gallery fetcher for Laravel. Use dA as data source and create awesome stuff (like a gallery!).
You can install the package via composer:
composer require apsg/da-gallery-fetcher
You can publish the config file with:
php artisan vendor:publish --provider="Apsg\Dafetcher\DafetcherServiceProvider" --tag="dafetcher-config"
This is the contents of the published config file:
return [
'username' => env('DA_USERNAME'),
'cache' => true,
'oauth' => [
'token_url' => 'https://www.deviantart.com/oauth2/token',
'client_id' => env('DA_CLIENT_ID'),
'secret' => env('DA_SECRET'),
],
];
The DA_USERNAME
variable is the default name of user you want to fetch the gallery (in most cases: your username).
Other variables (client ID and secret) can be obtained by registering your own OAUTH app here:
https://www.deviantart.com/developers/apps
$dafetcher = new Apsg\Dafetcher();
$collection = $dafetcher->fetch();
To change user just use fluent syntax:
$collection = $dafetcher->forUser('other-user')->fetch();
To disable cache permanently just set the config's variable cache
to false.
To disable temporarily just use helper:
$dafetcher = new Apsg\Dafetcher();
$freshResults = $dafetcher->noCache()->fetch();
To fetch data and automatically transform it using DTOs:
$transformedResults = $dafetcher->fetchTransformed();
composer test
It uses great oauth2 subscriber for guzzle: https://github.com/kamermans/guzzle-oauth2-subscriber
The MIT License (MIT). Please see License File for more information.