Docs Navigation +

PHP

You can use fuzzy.ai from your PHP project using the Open Source library.

Installation

You can download the software at: https://github.com/fuzzy-ai/php

You can also fork the repository on Github.

Overview

require_once './fuzzy.ai.php';

$API_KEY = "API KEY HERE";
$AGENT_ID = "AGENT_ID";

$srv = new FuzzyServer($API_KEY);

$agent = $srv->getAgent($AGENT_ID);

$outputs = $agent->evaluate(array('temperature' => 75));

Classes

FuzzyServer

This is the top-level class you use for accessing the Fuzzy.ai service.

Methods are:

  • constructor: parameters are $apiKey and $rootServer. The API key comes from your fuzzy.ai dashboard. The root server defaults to the main API server for Fuzzy.ai; change it if you need to use a mock for testing.
  • getAgent: parameters are $agentID. You get the agent ID from the agent editing page on the Fuzzy.ai Web site. This will return a FuzzyAgent instance.

FuzzyAgent

This is the representation of a Fuzzy.ai agent.

Methods are:

  • evaluate: parameters are $inputs, an associative array of input names to values. This will return an associative array of output names to value.