This package is abandoned and no longer maintained. No replacement package was suggested.

A php wrapper for the 4chan api

v1.0.0 2017-10-20 18:41 UTC

This package is not auto-updated.

Last update: 2020-01-24 17:11:54 UTC


Build Status Code Climate Code Climate Code Climate

A PHP api wrapper for the 4chan api.

Please see for usage rules.


Run composer require backendtea/fourchanapi ^1.0 For information about Composer check out their website


Get a list off all the Thread #'s of /v/

use FourChan\FourChan;


Grab all the images of the first thread we find on /v/

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:

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

foreach($posts as $post) {
        echo $post->getImageUrl();
    } catch(NoImageException $e) {
        //do nothing

Get the information of a thread

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

// true or false
//true or false
//true or false
//Subject or '' if no subject is set.
//# of OP

Get the information of a post

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

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.


Features, bug fixes etc are welcome, please check the for more info


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.