A PHP library for the Snapchat API

dev-master 2017-12-24 05:20 UTC

This package is not auto-updated.

Last update: 2020-07-10 18:13:56 UTC


** This library is no longer maintained!

This library is built to communicate with the Snapchat API. It was nearly feature complete and lacks some newer functionality available in the latest versions of the official apps (stories, text messages, and "chat").

It's similar to the excellent Snaphax library built by Thomas Lackner <@tlack>, but the approach is different enough that I figured it deserved its own repo.


Include src/snapchat.php via require_once or Composer or whatever, then:


// Log in:
$snapchat = new Snapchat('username', 'password');

// Get your feed:
$snaps = $snapchat->getSnaps();

// Get your friends' stories:
$snaps = $snapchat->getFriendStories();

// Download a specific snap:
$data = $snapchat->getMedia('122FAST2FURIOUS334r');
file_put_contents('/home/jorgen/snap.jpg', $data);

// Download a specific story:
$data = $snapchat->getStory('[story_media_id]', '[story_key]', '[story_iv]');

// Download a specific story's thumbnail:
$data = $snapchat->getStoryThumb('[story_media_id]', '[story_key]', '[thumbnail_iv]');

// Mark the snap as viewed:

// Mark the story as viewed:

// Screenshot!

// Upload a snap and send it to me for 8 seconds:
$id = $snapchat->upload(
$snapchat->send($id, array('jorgenphi'), 8);

// Upload a video story:
$id = $snapchat->upload(
$snapchat->setStory($id, Snapchat::MEDIA_VIDEO);

// Destroy the evidence:

// Find friends by phone number:
$friends = $snapchat->findFriends(array('18006492568', '7183876962'));

// Get a list of your friends:
$friends = $snapchat->getFriends();

// Add some people as friends:
$snapchat->addFriends(array('bill', 'bob'));

// Add someone you forgot:

// Get a list of the people you've added:
$added = $snapchat->getAddedFriends();

// Find out who Bill and Bob snap the most:
$bests = $snapchat->getBests(array('bill', 'bob'));

// Set Bart's display name:
$snapchat->setDisplayName('bart', 'Barty');

// Block Bart:

// Unblock Bart:

// Delete Bart entirely:

// You only want your friends to be able to snap you:

// You want to change your email:

// Log out:



There is none, but I tried to mark up the code well enough to make up for it. Error handling is pretty weak, so watch for that.