PHP code example of pete001 / frost-php-sdk

1. Go to this page and download the library: Download pete001/frost-php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pete001 / frost-php-sdk example snippets


composer 

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

$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
)

$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.
)

$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.
        )

)

vendor/bin/phpunit

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

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

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