PHP code example of nolikein / api-derpibooru-facade

1. Go to this page and download the library: Download nolikein/api-derpibooru-facade library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nolikein / api-derpibooru-facade example snippets


use Nolikein\ApiDerpibooruFacade\Requester;

$requester = new Requester();

use Nolikein\ApiDerpibooruFacade\Models\Image;

/** @var Image $image A model who represent an image */
$image = $requester->getImageById(1);
dd($image->name);

# Basic requests by id
$requester->getCommentById(idComment: $id);
$requester->getImageById(idImage: $id);
$requester->getTagById(tagId: $id);
$requester->getPostById(postId: $id);
$requester->getUserById(userId: $id);
$requester->getFilterById(filterId: $filter_id, authToken: $key = null);

# Basic requests by query
$requester->getCommentsByQuery(query: $q, authToken: $key = null, page: $page = null);
$requester->getGalleriesByQuery(query: $q, authToken: $key = null, page: $page = null);
$requester->getPostsByQuery(query: $q, authToken: $key = null, page: $page = null);
$requester->getImagesByQuery(query: $q, authToken: $key = null, page: $page = null, perPage: $per_page = null, filterId: $filter_id = null, sortDirection: $sd = null, sortField: $sf = null);
$requester->getTagsByQuery(query: $q, page: $page = null);

# Forum requests
$requester->getForums();
$requester->getForum(forumShortName: $short_name);
$requester->getTopics(forumShortName: $short_name, page: $page = null, perPage: $per_page = null);
$requester->getTopic(forumShortName: $short_name, topicSlug: $slug);
$requester->getPostsFromTopic(forumShortName: $short_name, topicSlug: $slug, page: $page = null, perPage: $per_page = null);
$requester->getPostFromTopic(forumShortName: $short_name, topicSlug: $topic_slug, topicId: $post_id);

# Miscellaneous requests
$requester->getFeaturedImage();
$requester->getFilterList(page: $page = null);
$requester->getUserFilters(authToken: $key, page: $page = null);
$requester->getOembedByUrl(url: $url);
$requester->doReverseImageSearchByUrl(url: $url, authToken: $key = null, distance: $distance = null);