2017 © Pedro Peláez
 

library fourchanapi

A php wrapper for the 4chan api

image

backendtea/fourchanapi

A php wrapper for the 4chan api

  • Friday, October 20, 2017
  • by BackEndTea
  • Repository
  • 1 Watchers
  • 1 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

FourChanApi

Build Status Code Climate Code Climate Code Climate, (*1)

A PHP api wrapper for the 4chan api., (*2)

Please see https://github.com/4chan/4chan-API for usage rules., (*3)

Instalation

Run composer require backendtea/fourchanapi ^1.0 For information about Composer check out their website, (*4)

Usage

Get a list off all the Thread #'s of /v/, (*5)

use FourChan\FourChan;

FourChan::board('v')->getThreads();

Grab all the images of the first thread we find on /v/, (*6)

use FourChan\FourChan;

$posts = FourChan::board('v')->getThreads()[0]->getPosts();

foreach($posts as $post) {
    if ($post->hasimage() {
        echo $post->getImageUrl();
    }
}

Any function related to getting image information throws a FourChan\Util\NoImageException when there is no image. So another way would be:, (*7)


$posts = FourChan::board('a')->getThreads()[0]->getPosts(); foreach($posts as $post) { try{ echo $post->getImageUrl(); } catch(NoImageException $e) { //do nothing } }

Get the information of a thread, (*8)

$thread = FourChan::board('a')->getThreads()[0];

// true or false
$thread->isStick();
//true or false
$thread->isClosed();
//true or false
$thread->isArchived();
//Subject or '' if no subject is set.
$thread->getSubject();
//# of OP
$thread->getID();

Get the information of a post, (*9)

$post = FourChan::board('a')->getThreads()[0]->getPosts()[0];
//Comment of the post, including escaped html.
$post->getFullComment();
//# of the post
$post->getID();

If you need more functionality, either make it yourself and shoot me a PR, or create an issue on Github and hope me or someone else does it for you., (*10)

Contributing

Features, bug fixes etc are welcome, please check the Contributing.md for more info, (*11)

Note

All of fake responses have been grabbed from live threads on 4chan, they do not necessarily represent my views, or of anyone who has worked on this project., (*12)

The Versions

20/10 2017

dev-master

9999999-dev

A php wrapper for the 4chan api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar BackEndTea

api 4chan

20/10 2017

v1.0.0

1.0.0.0

A php wrapper for the 4chan api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar BackEndTea

api 4chan

20/10 2017

dev-thread-functions

dev-thread-functions

A php wrapper for the 4chan api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar BackEndTea

api 4chan