geniza-ai / geniza-sdk-php
SDK for interacting with Geniza.ai API endpoints
Requires
- php: ^8.1
- ext-json: *
- guzzlehttp/guzzle: ^7.7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^v3.23.0
- nexusphp/cs-config: ^v3.14.4
- phpstan/extension-installer: *
- phpstan/phpstan: *
- phpstan/phpstan-strict-rules: *
- phpunit/phpunit: ^10.3.2
- rector/rector: 0.18.12
- roave/security-advisories: dev-latest
- sebastian/phpcpd: *
- vimeo/psalm: *
Suggests
- ext-curl: Helpful in interacting with Geniza.ai API servers.
- ext-openssl: Always a good idea
This package is auto-updated.
Last update: 2024-10-08 03:05:23 UTC
README
This SDK is the best and easiest way to connect to the Geniza.ai API.
Installation
Install using composer:
composer require geniza-ai/geniza-sdk-php
Usage
use Geniza\Geniza; new Geniza($key, $secretKey);
Detailed information on how to use the methods contained in this SDK can be found on in our API documentation.
Framework Integrations
CodeIgniter 4
Add the key and secret key to a config class.
<?php namespace Config; use CodeIgniter\Config\BaseConfig; class Geniza extends BaseConfig { public string $key = ''; public string $secretKey = ''; }
Note: These values should be set and overridden by your environment variables.
Add the following to your \Config\Services.php
file:
public static function geniza(bool $getShared = true) { if($getShared) { return static::getSharedInstance('geniza'); } return new \Geniza\Geniza( config('Geniza')->key, config('Geniza')->secretKey ); }
You can then instantiate your Geniza handle by simply calling the service method:
$geniza = \Config\Services::geniza(true);
Laravel
This is an example service provider which registers a shared Optimus instance for your entire application:
<?php namespace App\Providers; use Geniza\Geniza; use Illuminate\Support\ServiceProvider; class GenizaServiceProvider extends ServiceProvider { public function register() { $this->app->singleton(Geniza::class, function ($app) { $key = 'abcd1234'; $secretKey = 'efgh5678'; return new Geniza($key, $secretKey); }); } }
Once you have created the service provider, add it to the providers array in your config/app.php
configuration file:
App\Providers\GenizaServiceProvider::class,
More information: https://laravel.com/docs/5.3/container#resolving