2017 © Pedro Peláez
 

library frost-php-sdk

PHP SDK for the Poet Frost API

image

pete001/frost-php-sdk

PHP SDK for the Poet Frost API

  • Sunday, February 18, 2018
  • by pete001
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Po.et Frost API PHP SDK

Scrutinizer Code Quality Code Coverage Build Status StyleCI, (*1)

You think blockchain is cool? Check √, (*2)

You're a techie publisher who wants to stamp and protect their work? Check √, (*3)

You think Po.et is the most awesome platform to do this on? Check √, (*4)

You ignore the haters, and pursue your love for sweet fresh PHP 7? Check √, (*5)

Well alright then, sounds like you're in the right place!, (*6)

Background

You already passed the check test, so all you need are the official docs., (*7)

Installing

composer require pete001/frost-php-sdk

Configuration

Dont check in dat private key yo, use the dot env!, (*8)

Sign up and fetch your API key from here., (*9)

Add it to the .env in the project root., (*10)

Usage

Because i like xmas, i made a simple factory to save time:, (*11)

$api = (new FrostFactory)->api();

So far there are 3 juicy methods:, (*12)

Create Work

$work = $api->createWork([
    'name' => 'I am a pickle',
    'datePublished' => '2018-02-15T20:12:01+00:00',
    'dateCreated' => '2018-02-14T19:50:21+00:00',
    'author' => 'Pickle Rick',
    'tags' => 'pickle rick morty unimpressed',
    'content' => 'Rick tells Morty to come to the garage, and Morty discovers that Rick has turned himself into a pickle but is unimpressed.'
]);

print_r($work);

Array
(
    [workId] => 46b6144b7fc6825caa3cf4b83149226f8d3f7bc0b20e6780c5d80423d1a5b86a
)

Get Work

$work = $api->getWorkById('46b6144b7fc6825caa3cf4b83149226f8d3f7bc0b20e6780c5d80423d1a5b86a');

print_r($work);

Array
(
    [name] => I am a pickle
    [datePublished] => 2018-02-15T20:12:01+00:00
    [dateCreated] => 2018-02-14T19:50:21+00:00
    [author] => Pickle Rick
    [tags] => pickle rick morty unimpressed
    [content] => Rick tells Morty to come to the garage, and Morty discovers that Rick has turned himself into a pickle but is unimpressed.
)

Get All Works

$work = $api->getWorks();

print_r($work);

Array
(
    [0] => Array
        (
            [name] => I am a pickle
            [datePublished] => 2018-02-15T20:12:01+00:00
            [dateCreated] => 2018-02-14T19:50:21+00:00
            [author] => Pickle Rick
            [tags] => pickle rick morty unimpressed
            [content] => Rick tells Morty to come to the garage, and Morty discovers that Rick has turned himself into a pickle but is unimpressed.
        )

    [1] => Array
        (
            [name] => I am still a pickle
            [datePublished] => 2018-02-15T21:12:01+00:00
            [dateCreated] => 2018-02-14T20:50:21+00:00
            [author] => Pickle Rick
            [tags] => pickle rick morty unimpressed repetitive
            [content] => Rick tells Morty once again, to come to the garage, and Morty discovers that Rick is still a pickle. He remains unimpressed.
        )

)

Tests

Project has 100% test coverage, but due to my hipster nature, the CI is run over at Gitlab. So you'll just have to take my word for it., (*13)

To run the test suites, simply execute:, (*14)

vendor/bin/phpunit

If you wanna get fancy and check code coverage:, (*15)

vendor/bin/phpunit --coverage-html tests/coverage

If you're as OCD as i am, you might wanna run some static analysis:, (*16)

vendor/bin/phpmetrics --report-html="tests/static" .

Contributing

All contributions are welcome! Just fire up a PR and pinky swear the code passes the tests, has new tests written to maintain 100% coverage and make sure its PSR-2 compliant:, (*17)

vendor/bin/php-cs-fixer fix --verbose

License

As tempting as it is to troll the world by centralising the distribution of an app for the decentralised world... This is free, free for all!, (*18)

MIT License, (*19)

The Versions

18/02 2018

dev-master

9999999-dev https://github.com/pete001/poet-php-sdk

PHP SDK for the Poet Frost API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pete Cheyne

api php sdk crypto blockchain poet frost

16/02 2018
15/02 2018
15/02 2018