2017 © Pedro Peláez
 

library icndb

PHP Wrapper for The Chuck Norris Db API

image

icndb/icndb

PHP Wrapper for The Chuck Norris Db API

  • Wednesday, January 30, 2013
  • by Apathetic012
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,871 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 3 Versions
  • 4 % Grown

The README.md

icndb/icndb

A PHP Wrapper for for the Internet Chuck Norris Database (ICNDb)., (*1)

Build Status Still Maintained, (*2)

Install

To ease the process, I recommend you use composer., (*3)

{
    "require": {
        "icndb/icndb": "1.0.x"
    }
}

Usage

<?php
$config = array(
    'firstName' => 'Cyrus',
    'lastName' => 'David'
);

// Pass an optional parameter to change the firstName and lastName
// Default is Chuck Norris
$chuck = new ICNDb\Client($config);

// Get the total Chuck Norris jokes stored in ICNDb
$total = $chuck->count()->get();

// Get all categories
$categories = $chuck->categories()->get();

// Get a specific joke by it's ID
$specific = $chuck->specific(18)->get();

//Get a random joke
$random = $chuck->random()->get();

// Get multiple random jokes
$random2 = $chuck->random(3)->get();

// use exclude() to get jokes not belong to that category
$exclude = $chuck->random()->exclude('nerdy')->get();

// you can also supply an array
$exclude2 = $chuck->random()->exclude(array('nerdy', 'explicit'))->get();

// or chain them
$exclude3 = $chuck->random(2)->exclude('explicit')->exclude('nerdy')->get();

// use limitTo() to get jokes only from that category
// you may supply an array or chain them like exclude()
$limit = $chuck->random()->limitTo('nerdy')->get();

Exceptions

APIUnavailableException - API is either unreachable/unavailable, (*4)

ChainNotAllowedException - When these methods are chained together random(), specific($id), categories(), count(), (*5)

Tests

To run the unit test suite:, (*6)

cd tests
curl -s https://getcomposer.org/installer | php
php composer.phar install
./vendor/bin/phpunit

The Versions

30/01 2013

dev-master

9999999-dev http://github.com/Apathetic012/ICNDb

PHP Wrapper for The Chuck Norris Db API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

chuck-norris jokes icndb

26/01 2013

v1.0.1

1.0.1.0 http://github.com/Apathetic012/ICNDb

PHP Wrapper for The Chuck Norris Db API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

chuck-norris jokes icndb

11/12 2012

v1.0.0

1.0.0.0 http://github.com/Apathetic012/ICNDb

PHP Wrapper for The Chuck Norris Db API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

chuck-norris jokes icndb