NullNude PHP API Client Library
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

PHP SDK for NullNude API

Build Status Latest Stable Version

This PHP SDK is a wrapper for our NullNude API, a nudity detection/moderation service.

Use the NullNude API to instantly moderate adult content in user-submitted photos.


The NullNude PHP SDK can be installed with Composer.

php composer.phar require dneural/php-nullnude dev-master

or by adding the repository to your composer.json by hand:

    "require": {
        "dneural/php-nullnude": "dev-master"

and then installing the SDK by running:

php composer.phar install

Check the examples directory to learn how to use the SDK effectivly.

Authenticate to NullNude API

Each application that uses NullNude API needs to be authenticated. For that reason you will have to register an account with us. It is a very easy process and can be done at this address:

Write down your api_key and api_secret and you're ready to go.

Checking for nudity, regions of interest.

Checking if images contain nudity in them is easy. Provide an URL or a local file path of the image you would like checked to one of the few methods that our API supports.

require __DIR__ . '/vendor/autoload.php';
use NullNude\NullNude;

// Information about your API access.
$config = [
    'api_key'    => 'YOUR_API_KEY',
    'api_secret' => 'YOUR_API_SECRET'

// Initialize the NullNude client.
$nullNude = new NullNude($config);

// Image can be either a local path or an external url.
$image = "";

// Check if the image has nuidty in it.
$nudityResource = $nullNude->checkNudity($image);
if ( $nudityResource->hasNudity() ) {
    // Take action based on your confidence preference.
    echo 'Image nudity confidence: ' . 

// Get the array of regions of interest within the image.
$roiResource = $nullNude->getRoi($image);
echo "<pre>";
echo "</pre>";

// Check if the image has been moderated, moderate.json 
// applies the filter only if there was nudity present.
$moderateResource = $nullNude->moderate($image);
if ( $moderateResource->isModerated() ) {
    // Download and save the moderated image.
    echo 'Moderated image url: ' . 

Consider checking the examples directory for more real life usage examples.

How to build the documentation?

Documentation is based on phpdocumentor. To install it clone the php-nullnude project:

git clone
cd php-nullnude
php composer.phar install

To generate documentation in the ./docs/nullnude directory run:

./vendor/bin/phpdoc -d ./src -t ./docs/nullnude

How to run tests?

Tests are based on phpunit. To run them clone the php-nullnude project:

git clone
cd php-nullnude
php composer.phar install

and run this command:

./vendor/bin/phpunit --coverage-text


The SDK code is released under a MIT style license, which means that it should be easy to integrate it in your applications.
Check the LICENSE file for more information.