banana-dev/banana-dev

A PHP client to interact with Banana's machine learning inference APIs

0.1.0 2023-11-01 14:44 UTC

This package is auto-updated.

Last update: 2024-03-30 00:32:04 UTC


README

Using it

Refer to our main docs for running inference with your AI apps on Banana.dev. Refer to our API docs for interacting with the API.

To get started:

composer require banana-dev/banana-dev
<?php

use BananaDev/Client;
use BananaDev/API;

$client = new Client("your api key", "https://project-slug.run.banana.dev");
$api = new API("your api key");

Testing

mkdir example
cd example
composer init --name=banana-dev/example --description="" --author="" --autoload=src/ --repository='{"type":"path","url":"../"}' --license="" --require="banana-dev/banana-dev @dev" --require="guzzlehttp/guzzle:^7.8" --stability=dev --no-interaction

Say yes to the discovery prompt.

composer install

Create a test.php within example/src with your own API key.

<?php

require __DIR__ . '/../vendor/autoload.php';

use BananaDev\API;

$api = new API("11111111-1111-1111-1111-111111111111");

$projects = $api->listProjects();
var_dump($projects);

$project = $api->getProject($projects->json['results'][0]['id']);
var_dump($project);

$updated = $api->updateProject($project->json['id'], [
    'maxReplicas' => 3,
]);
var_dump($updated);

Development

Install Homebrew

curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh

Install PHP and Composer

brew install php composer

Install dependencies

composer install

Run tests

composer test

Format code

composer format