2017 © Pedro Peláez
 

library irkfdb-php-client

PHP Client for Internet Rajinikanth Facts Database - irkfdb.in

image

irkfdb/irkfdb-php-client

PHP Client for Internet Rajinikanth Facts Database - irkfdb.in

  • Friday, June 8, 2018
  • by swapnilsarwe
  • Repository
  • 2 Watchers
  • 1 Stars
  • 50 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 47 % Grown

The README.md

irkfdb.in php client Build Status StyleCI

PHP API Client for the Internet Rajinikanth Facts Database. Its a wrapper class for the free database of Rajinikanth Facts hosted by irkfdb.in, (*1)

Install

Using Composer, (*2)

composer require irkfdb/irkfdb-php-client

Usage

To get the categories, (*3)

require_once "vendor/autoload.php";

use Irkfdb\IrkfdbClient;

$irkfdbClient = new IrkfdbClient();
$irkfdbClient->getCategories()

Sample Response, (*4)

Array
(
    [status] => OK
    [resultSet] => Array
        (
            [data] => Array
                (
                    [0] => nsfw
                    [1] => geeky
                )
        )
)

In case of API failure, the response would be as follows Sample Response, (*5)

Array
(
    [status] => FAIL
    [errMessage] => '<err message>'
)

To get the random fact, (*6)

$irkfdbClient = new IrkfdbClient();
$irkfdbClient->getRandomFact()

Sample Response, (*7)

Array
(
    [status] => OK
    [resultSet] => Array
        (
            [data] => Array
                (
                    [0] => Array
                        (
                            [hash_id] => 9a004def16176d9a2b258a15bf898119
                            [db_id] => 426
                            [fact] => Rajinikanth writes code that optimizes itself.
                            [categories] => Array
                                (
                                    [0] => geeky
                                )
                            [sources] => Array
                                (
                                    [0] => api.icndb.com
                                    [1] => raw.githubusercontent.com/jenkinsci
                                )
                        )
                )

            [total_facts] => 9361
        )
)

To get the random fact from the selected category/categories, (*8)

$irkfdbClient = new IrkfdbClient();
// random fact belonging to one category
$irkfdbClient->fromCategories('geeky')->getRandomFact();

//or for multiple categories
$irkfdbClient->fromCategories('nsfw,geeky')->getRandomFact();
or
$irkfdbClient->fromCategories(['nsfw','geeky'])->getRandomFact();

To exclude the fact from the particular category/categories, (*9)

$irkfdbClient = new IrkfdbClient();
// random fact belonging to one category
$irkfdbClient->excludeCategories('geeky')->getRandomFact();

//or for multiple categories
$irkfdbClient->excludeCategories('nsfw,geeky')->getRandomFact();
or
$irkfdbClient->excludeCategories(['nsfw','geeky'])->getRandomFact();

Running the tests

./vendor/bin/phpunit --configuration phpunit.xml

The Versions

08/06 2018

dev-master

9999999-dev

PHP Client for Internet Rajinikanth Facts Database - irkfdb.in

  Sources   Download

MIT

The Requires

 

The Development Requires

by Swapnil Sarwe

05/04 2018

dev-analysis-8mj4LE

dev-analysis-8mj4LE

PHP Client for Internet Rajinikanth Facts Database - irkfdb.in

  Sources   Download

MIT

The Development Requires

by Swapnil Sarwe

09/02 2018

dev-l5.5

dev-l5.5

PHP Client for Internet Rajinikanth Facts Database - irkfdb.in

  Sources   Download

MIT

The Requires

 

by Swapnil Sarwe