Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/arifszn/reddit-image-fetcher-php

A PHP package for fetching reddit images, memes, wallpapers and more.
https://github.com/arifszn/reddit-image-fetcher-php

memes reddit reddit-api wallpapers

Last synced: 3 months ago
JSON representation

A PHP package for fetching reddit images, memes, wallpapers and more.

Awesome Lists containing this project

README

        



Reddit Image Fetcher

Reddit Image Fetcher


A PHP package for fetching reddit images, memes, wallpapers and more.


https://arifszn.github.io/reddit-image-fetcher-php







Preview



Shadow

- Bulk images
- Bulk memes
- Bulk wallpapers
- Customizable
- Lightweight
- Zero dependency

> JavaScript version: Reddit Image Fetcher

## Resources

- [Demo](https://memedb.netlify.app)
- [Documentation](https://arifszn.github.io/reddit-image-fetcher-php)

## Installation

Install via composer

```
composer require arifszn/reddit-image-fetcher
```

## Usage

```php
use arifszn\RedditImageFetcher\RedditImageFetcher;

$redditImageFetcher = new RedditImageFetcher();

$result = $redditImageFetcher->fetch('meme'); // fetch 1 meme
$result = $redditImageFetcher->fetch('wallpaper'); // fetch 1 wallpaper

$result = $redditImageFetcher->fetch('wallpaper', 50); // fetch 50 wallpapers

// custom image fetch from given subreddits
$result = $redditImageFetcher->fetch(
'custom',
50,
['cats', 'Catswhoyell', 'sleepingcats']
); // fetch 50 cat images from custom subreddit library

$result = $redditImageFetcher->fetch(
'meme',
50,
[],
['memes', 'funny'],
['dankmemes']
); // fetch 50 memes by adding two subreddits and removing 1 subreddit from default subreddit library

```

## Sample Response

```php
array:2 [▼
0 => array:10 [▼
"id" => "hfh51v"
"type" => "wallpaper"
"title" => "Illuminated City at Night [1920 x 1200]"
"postLink" => "https://redd.it/hfh51v"
"image" => "https://i.redd.it/b6x9i2n830751.jpg"
"thumbnail" => "https://b.thumbs.redditmedia.com/mLCk8Bh0N4M8hZafHsbAmw8rM7JEEznsT2nRZSo3GsU.jpg"
"subreddit" => "wallpaper"
"NSFW" => false
"spoiler" => false
"createdUtc" => 1593066557.0
"upvotes" => 1899
"upvoteRatio" => 1.0
]
1 => array:10 [▼
"id" => "h9glhi"
"type" => "wallpaper"
"title" => "Missing Home by Just Jaker"
"postLink" => "https://redd.it/h9glhi"
"image" => "https://cdnb.artstation.com/p/assets/images/images/027/020/665/large/just-jaker-galax-noise.jpg"
"thumbnail" => "https://b.thumbs.redditmedia.com/4utBLNbsIDDLl46z494PCRkDhmAnapQq9FL7l-07aJo.jpg"
"subreddit" => "ImaginaryFuturism"
"NSFW" => false
"spoiler" => false
"createdUtc" => 1592228591.0,
"upvotes" => 462
"upvoteRatio" => 1.0
]
]
```

## Options

| Property | Type | Description | Default |
| :----------- | :---: | :------------------------------------- | :----: |
| type | string | 'meme' \| 'wallpaper' \| 'custom' | 'meme' |
| total | int | How many images to get. Max is 50 | 1 |
| subreddit | array | Custom subreddit libray | [ ] |
| addSubreddit | array | Add subreddits to subreddit library | [ ] |
| removeSubreddit | array | Remove subreddits from subreddit library | [ ] |

## Contribute

To contribute, clone this repo locally and commit your code on a new branch. Feel free to create an issue or make a pull request.

## Thank You

[![Stargazers repo roster for @arifszn/reddit-image-fetcher-php](https://reporoster.com/stars/arifszn/reddit-image-fetcher-php)](https://github.com/arifszn/reddit-image-fetcher-php/stargazers)

## Support

Show your ❤️ and support by giving a ⭐.

## License

**Reddit Image Fetcher** is licensed under the [MIT License](https://github.com/arifszn/reddit-image-fetcher-php/blob/main/LICENSE).