get-stackable/stackable-php

There is no license information available for the latest version (dev-master) of this package.

Official Stackable library for PHP

dev-master 2016-03-21 21:12 UTC

This package is not auto-updated.

Last update: 2024-04-24 22:11:24 UTC


README

This is the Official Stackable API PHP library for getting data from stacks.

Getting started

Install using Composer

$ composer install get-stackable/stackable-php

Or simple include src/Stackable.php file to your project.

Usage

Make sure to create an account at http://www.stackable.space and setup your Stack and Containers.

To initialize

$stackable = new Stackable('YOUR-STACK-PUBLIC-KEY-HERE');

To list all containers

$result = $stackable->getContainers();
print_r($result);

To get single containers

$result = $stackable->getContainer('CONTAINER-ID-HERE');
print_r($result);

To get all items within single container

$result = $stackable->getContainerItems('CONTAINER-ID-HERE');
print_r($result);

To get all items within stack

$result = $stackable->getAllItems();
print_r($result);

To get single item

$result = $stackable->getItem('ITEM-ID-HERE');
print_r($result);

To create new item

  • First initialize, using PRIVATE KEY, (MAKE SURE YOU KEEP THIS KEY SAFE! MOSTLY ON SERVER SIDE)
$stackable = new Stackable('YOUR-STACK-PRIVATE-KEY-HERE');
var dataToPost = [
    name => 'John Doe',
    age => 29
];

$result = $stackable->createItem('CONTAINER-ID-HERE', dataToPost);
print_r($result);

To update an item

var dataToPost = [
    name => 'John Doe',
    age => 29
];

$result = $stackable->updateItem('ITEM-ID-HERE', dataToPost);
print_r($result);

To play with this library: https://beta.tehplayground.com/D85vaCf8xDxKeb8S

Todo

  • Write tests.
  • Test create and update item methods