(new Soapbox())->shout(array_map('strtoupper', $opinions)); //Shaun's blog


Me, elsewhere

GitHub
parseword
Miscellaneous public code

snuze
A PHP API client for Reddit

Twitter
@parseword
I don't tweet much

XMPP chat
xmpp@shaunc.com
(Pidgin, Miranda, Swift, etc.)


Perfect is the enemy of good enough.

Introducing Snuze, a PHP client for the Reddit API

Posted August 19, 2019 by shaun

I spend a lot of time on Reddit, and have wanted to explore their public API for years. Last month that itch struck again and I finally decided to scratch it. Armed with a list of data I needed to spider and crunch (more on that another day, maybe), I set out to see what libraries are available. The most popular Reddit API client is written in Python, which I don't grok, and the PHP offerings didn't excite me much. You already know how this story ends; I decided to start writing my own.

Enter Snuze, a new PHP client for Reddit's API.

It's in a preview release state while I get the design stabilized. At the moment, Snuze can:

  • Authenticate via OAuth
  • Store and re-use OAuth bearer tokens until expired
  • Track the API rate limit status and autopause when the bucket's empty
  • Fetch subreddit data (and optionally persist to MySQL)
  • Fetch link data (and optionally persist to MySQL)
  • Fetch user account data

Snuze comes with entity classes to encapsulate the various types of Reddit "things," so you can work with traditional PHP objects and accessors instead of wading around knee-deep in JSON arrays. There's also a built-in basic MySQL persistence layer to store what you fetch, if you want to analyze it externally.

There's way more to do, but the package is at a point where it could be useful to others, so I decided to publish it. I have a bad habit of building out hobby projects to a point where they're good enough for me, then never releasing the code. Putting Snuze out in public will, I hope, help motivate me to keep working on it!

I'm taking a brief respite from development to work on the documentation, before the code gets too far ahead of the docs. Anyway, enjoy Snuze, and all feedback is welcome!



Recent articles

📰 Compiling Doxygen on FreeBSD without LaTeX and Ghostscript

📰 Introducing Snuze, a PHP client for the Reddit API

📰 jisusaiche: Java's installer telemetry

📰 BIND client log error "query_find: query_getdb failed"

📰 Resolving "The lang/perl5.24 port has been deleted: Has expired" portmaster error

📰 Armagaddon2 interim fix for Firefox 56 and other old versions

📰 Strange DNS queries: qname "miep", qtype ANY

📰 Undeliverable as addressed: A massive broken spam campaign?

📰 Using WITH_META_MODE and ccache for FreeBSD build boosts

📰 Resolving subversion error E000013: Unable to create pristine install stream

📰 Enhancements to SmokePing's AnotherDNS probe

📰 Generating vanity DNSSEC key tags

📰 DDoS involving forged packets from 23.225.141.70

📰 Website integrity monitoring through version control

📰 SpamAssassin 3.4.2 fixes security problems, adds HashBL and phishing plugins

▲ Back to top | Permalink to this page