Download the PHP package justpush-io/php-jokeapi without Composer
On this page you can find all versions of the php package justpush-io/php-jokeapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download justpush-io/php-jokeapi
More information about justpush-io/php-jokeapi
Files in justpush-io/php-jokeapi
Package php-jokeapi
Short Description The missing piece in php, a php wrapper for the famous jokes API
License MIT
Informations about the package php-jokeapi
JokeAPI PHP
A PHP wrapper for the JokeAPI.
Installation
Currently, this package is not available on Packagist. To use it, simply clone this repository:
Usage
Features
The JokeAPI PHP client supports all the features of the JokeAPI:
- Multiple categories
- Blacklist flags
- Different formats (JSON, XML)
- Joke types (single, twopart)
- Search functionality
- Specific joke IDs
- Multiple languages
- Safe mode
Methods
categories(array $categories)
Set the categories for the jokes.
Available categories:
CATEGORY_ANY
(default)CATEGORY_MISC
CATEGORY_PROGRAMMING
CATEGORY_DARK
CATEGORY_PUN
CATEGORY_SPOOKY
CATEGORY_CHRISTMAS
blacklist(array $flags)
Set blacklist flags to filter jokes.
Available flags:
FLAG_NSFW
FLAG_RELIGIOUS
FLAG_POLITICAL
FLAG_RACIST
FLAG_SEXIST
FLAG_EXPLICIT
format(string $format)
Set the response format (json or xml).
type(string $type)
Set the joke type (single or twopart).
Available types:
TYPE_SINGLE
TYPE_TWOPART
search(string $searchString)
Search for jokes containing the specified string.
id(int $id)
Get a joke by ID.
language(string $language)
Set the language for the jokes.
Available languages:
LANG_ENGLISH
(default)LANG_CZECH
LANG_GERMAN
LANG_SPANISH
LANG_FRENCH
LANG_PORTUGUESE
safe(bool $safe = true)
Enable safe mode (excludes nsfw jokes).
fetch()
Fetch a joke from the API.
Chaining
All methods (except fetch()
) return the client instance for method chaining:
License
MIT
Credits
This is a PHP port of the jokeapi Go package by Icelain.