2017 © Pedro Peláez
 

library php-snapchat

A PHP library for the Snapchat API

image

jorgenphi/php-snapchat

A PHP library for the Snapchat API

  • Sunday, December 24, 2017
  • by JorgenPhi
  • Repository
  • 37 Watchers
  • 231 Stars
  • 342 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 73 Forks
  • 77 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Snapchat for PHP

** This library is no longer maintained!, (*1)

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")., (*2)

It's similar to the excellent Snaphax library built by Thomas Lackner @tlack" title="See online @tlack">@tlack, but the approach is different enough that I figured it deserved its own repo., (*3)

Usage

Include src/snapchat.php via require_once or Composer or whatever, then:, (*4)

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:
$snapchat->markSnapViewed('122FAST2FURIOUS334r');

// Mark the story as viewed:
$snapchat->markStoryViewed('[story_id]');

// Screenshot!
$snapchat->markSnapShot('122FAST2FURIOUS334r');

// Upload a snap and send it to me for 8 seconds:
$id = $snapchat->upload(
    Snapchat::MEDIA_IMAGE,
    file_get_contents('/home/jorgen/whatever.jpg')
);
$snapchat->send($id, array('jorgenphi'), 8);

// Upload a video story:
$id = $snapchat->upload(
    Snapchat::MEDIA_VIDEO,
    file_get_contents('/home/jorgen/whatever.mov')
);
$snapchat->setStory($id, Snapchat::MEDIA_VIDEO);

// Destroy the evidence:
$snapchat->clearFeed();

// 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:
$snapchat->addFriend('bart');

// 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:
$snapchat->block('bart');

// Unblock Bart:
$snapchat->unblock('bart');

// Delete Bart entirely:
$snapchat->deleteFriend('bart');

// You only want your friends to be able to snap you:
$snapchat->updatePrivacy(Snapchat::PRIVACY_FRIENDS);

// You want to change your email:
$snapchat->updateEmail('jorgen@example.com');

// Log out:
$snapchat->logout();

?>

Documentation

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., (*5)

License

MIT, (*6)

The Versions

24/12 2017

dev-master

9999999-dev

A PHP library for the Snapchat API

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *
  • ext-json *
  • ext-mcrypt *

 

by Daniel Stelljes

snapchat