GithubHelp home page GithubHelp logo

php-wrapper's Introduction

Basics

Installation

With Composer, create a composer.json file and run the php composer.phar install command to install it:

{
    "require": {
        "eyeem/php-wrapper": "~2.1"
    }
}

Without Composer, clone this repository and include the autoload file:

require_once __DIR__ . '/eyeem/API-php-wrapper/autoload.php';

Then instanciate the class and set your client_id and client_secret:

$eyeem = new Eyeem();
$eyeem->setClientId('CLIENT_ID');
$eyeem->setClientSecret('CLIENT_SECRET');

Resources

Photo

Querying an object: $photo = $eyeem->getPhoto('{photo_id}');

Acceding a property: echo $photo->caption; or echo $photo->getCaption();

Getting an object as array: $array = $photo->toArray();

List of photo properties: 'id', 'thumbUrl', 'photoUrl', 'width', 'height', 'updated', 'webUrl', 'user', 'caption', 'totalLikes', 'totalComments'

$photo->getUser(); return an user object.

Acceding a ressource collection: $comments = $photo->getComments();

Or: foreach ($photo->getLikers() as $user) { echo $user->getFullname(); }

List of photo collections: 'likers' (users), 'albums', 'comments'

Post a comment: $photo->postComment('Nice Photo!');

Like/Unlike a photo: $photo->like(); and $photo->unlike();

User

$user = $eyeem->getUser('{user_id}');

Acceding a property: echo $user->fullname; or echo $user->getFullname();

List of user properties: 'id', 'fullname', 'nickname', 'thumbUrl', 'photoUrl', 'totalPhotos', 'totalFollowers', 'totalFriends', 'totalLikedAlbums', 'totalLikedPhotos', 'webUrl', 'description'

List of user collections: 'photos', 'friends' (users), 'followers' (users), 'likedAlbums', 'likedPhotos', 'friendsPhotos', 'feed' (album)

Example: foreach ($user->getFriends() as $friend) { echo $friend->getFullname(); }

Follow/Unfollow an user: $user->follow(); and $user->unfollow();

Search users: foreach ($eyeem->searchUsers('ramz') as $user) { echo $user->getFullname(); }

Authenticated User

Extend the the user ressource.

$authUser = $eyeem->getAuthUser();

Update user informations: $authUser->update(array('fullname' => 'Santa Klaus'));

Album

$album = $eyeem->getAlbum('{album_id}');

List of album properties: 'id', 'name', 'thumbUrl', 'updated', 'webUrl', 'type', 'totalPhotos', 'totalLikers', 'totalContributors'

List of album collections: 'photos', 'likers' (users), 'contributors' (users)

Example: foreach ($album->getPhotos() as $photo) { echo $photo->getCaption(); }

Subscribe/Unsubscribe to an album: $album->subscribe(); and $album->unsubscribe();

Add an existing photo to an album: $album->addPhoto($photo); and $album->addPhoto('{photo_id_}');

Remove a photo from an album: $album->removePhoto($photo); and $album->removePhoto('{photo_id_}');

Search albums: foreach ($eyeem->searchAlbums('berlin') as $album) { echo $album->getName(); }

Comment

List of comment properties: 'id', 'photoId', 'updated', 'message', 'user'

$comment->getUser(); return an user object.

Delete a comment: $comment->delete();

Upload a photo

1 step:

$photo = $eyeem->postPhoto(array('photo' => '@/home/me/a-nice-photo.jpg', 'caption' => 'A nice photo.'));

2 steps:

$filename = $eyeem->uploadPhoto('/home/me/a-nice-photo.jpg');
$photo = $eyeem->postPhoto(array('filename' => $filename, 'caption' => 'A nice photo.'));

License

Copyright 2012-2013 EyeEm Mobile GmbH

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

php-wrapper's People

Contributors

znarf avatar tobitos avatar larsfronius avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.