2017 © Pedro Peláez
 

library watson

A PHP implementation of IBM's Watson REST API

image

juicekit/watson

A PHP implementation of IBM's Watson REST API

  • Friday, September 30, 2016
  • by ynunez
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

JuiceKit Watson

Build Status Codacy Badge Codacy Badge, (*1)

JuiceKit Watson is a PHP implementation of IBM's Watson REST API., (*2)

Note: Currently, only the VisualRecognition API is supported, other APIs will be supported in the future. For more information on available Watson APIs visit http://www.ibm.com/watson/developercloud/, (*3)

Installation

composer require juicekit/watson, (*4)

Example Usage

Classify an image from a url or file, (*5)

<?php
require_once '../vendor/autoload.php';

use JuiceKit\Watson as Watson;

$visualRecognition = new Watson\VisualRecognition\v3\VisualRecognition('YOUR_API_KEY', 'YOUR_VERSION');

/**
 * $responseWithImageUrl = [
 *      'custom_classes'=> 0,
 *      'images'=> [
 *          [
 *              'classifiers'=> [
 *                  'classes'=> [
 *                      [
 *                          'class'=> 'person',
 *                          'score'=> '0.999999',
 *                          'type_hierarchy'=> '/people'
 *                      ]
 *                  ],
 *                  'classifier_id'=> 'default',
 *                  'name'=> 'default'
 *              ]
 *          ]
 *      ],
 *      'images_processed'=> 1
 * ]
 */
$responseWithImageUrl = $visualRecognition->classify('http://your-image-resource.com/image.jpg');

$imageResource = fopen('your-image.jpg', 'r');

/**
 * $responseWithImageFile = [
 *      'custom_classes'=> 0,
 *      'images'=> [
 *          [
 *              'classifiers'=> [
 *                  'classes'=> [
 *                      [
 *                          'class'=> 'person',
 *                          'score'=> '0.999999',
 *                          'type_hierarchy'=> '/people'
 *                      ]
 *                  ],
 *                  'classifier_id'=> 'default',
 *                  'name'=> 'default'
 *              ]
 *          ]
 *      ],
 *      'images_processed'=> 1
 * ]
 */
$responseWithImageFile = $visualRecognition->classify($imageResource);

The Versions

30/09 2016

dev-master

9999999-dev

A PHP implementation of IBM's Watson REST API

  Sources   Download

Apache

The Requires

 

The Development Requires

by Yoel Nunez

ibm watson visual recognition juicekit