2017 © Pedro Peláez
 

project fotkomotko-php-sdk

Fotkomotko PHP SDK

image

meriksk/fotkomotko-php-sdk

Fotkomotko PHP SDK

  • Tuesday, February 24, 2015
  • by meriksk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Fotkomotko PHP SDK

Fotkomotko Client is a SDK library that allows to fetch data from Fotkomotko Services., (*1)

Basic Usage

Use new \Fotkomotko\Api($options) to create and initialize an API client. Option base_url is required. The minimal you'll need to have is:, (*2)

<?php
// require the Fotkomotko autoloader
require_once '/path/to/FotkomotkoClient/src/autoload.php';
// alternatively, use composer

$options = array(
    'base_url' => 'http://url-to-fotkomotko/api',
    'username' => 'your_username',
    'password' => 'your_password',
);
$api = new \Fotkomotko\Api($options);

With Composer:, (*3)

Add the "meriksk/fotkomotko-php-sdk": "@stable" into the require section of your composer.json. Run composer install. The example will look like, (*4)

require_once __DIR__ . '/vendor/autoload.php';

$options = [
    'base_url' => 'http://url-to-fotkomotko/api',
    'username' => 'your_username',
    'password' => 'your_password',
];

$api = new \Fotkomotko\Api($options);

Endpoints

Albums

// Get a single album (find by Id)
$response = $api->getAlbum(1);

    if ($response->success) {
        echo '<p>Album: <strong>' . $response->data['title'] . '</strong></p>';
    } else {
        echo '<p>Error: <strong>' . $response->code . ': ' . $response->message . '</strong></p>';
    }

// Get a single album (find by album title)
$response = $api->getAlbum('album-title');

    if ($response->success) {
        echo '<p>Album: <strong>' . $response->data['title'] . '</strong></p>';
    } else {
        echo '<p>Error: <strong>' . $response->code . ': ' . $response->message . '</strong></p>';
    }

// Get list of albums
$response = $api
    ->visibility(\Fotkomotko\Api::VISIBILITY_PUBLIC)
    ->continents(\Fotkomotko\Api::EUROPE)
    ->years(2014)
    ->sort('-date')
    ->getAlbums(array(
        'tags' => 'europe'
    ));

    if ($response->success) {
        foreach($response->data['items'] as $album { ... }
    } else {
        echo '<p>Error: <strong>' . $response->code . ': ' . $response->message . '</strong></p>';
    }

Photos


// Get single photo $response = $api->getPhoto(1); if ($response->success) { echo '<p>Photo: <strong>' . $response->data['title'] . '</strong></p>'; } else { echo '<p>Error: <strong>' . $response->code . ': ' . $response->message . '</strong></p>'; } // Get list of photos from a single album $response = $api->albums(1)->getAlbums($params); if ($response->success) { foreach($response->data['items'] as $photo { ... } } else { echo '<p>Error: <strong>' . $response->code . ': ' . $response->message . '</strong></p>'; }

Collections

// Get single collection
$response = $api->getCollection(1);

    if ($response->success) {
        echo '<p>Collection: <strong>' . $response->data['title'] . '</strong></p>';
    } else {
        echo '<p>Error: <strong>' . $response->code . ': ' . $response->message . '</strong></p>';
    }

// Get list of collection
$response = $api->getCollections(array(
    'albums' => true,
    'coverPhoto' => true,
));

    if ($response->success) {
        foreach($response->data['items'] as $collection { ... }
    } else {
        echo '<p>Error: <strong>' . $response->code . ': ' . $response->message . '</strong></p>';
    }


The Versions

24/02 2015

dev-master

9999999-dev

Fotkomotko PHP SDK

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • php >=5.3

 

by Marek Drugac

api sdk fotkomotko

24/02 2015

dev-develop

dev-develop

Fotkomotko PHP SDK

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • php >=5.3

 

by Marek Drugac

api sdk fotkomotko

26/08 2014

0.1

0.1.0.0

Fotkomotko API

  Sources   Download

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-json *

 

by Marek Drugac

api sdk fotkomotko