compredict / ai-sdk-laravel
Compredict's AI Core API for laravel.
Requires
- php: >=7.0
- compredict/ai-sdk: dev-master
- illuminate/support: ~5.1|^6.0|^7.0
Requires (Dev)
- phpunit/phpunit: ~4.0|~5.0
Suggests
- laravel/framework: To test the Laravel bindings
- laravel/lumen-framework: To test the Lumen bindings
This package is auto-updated.
Last update: 2025-02-16 21:30:14 UTC
README
This is a simple Laravel service provider for making it easy to include the official COMPREDICT SDK for PHP in your Laravel and Lumen applications.
This README is for version 1.x of the service provider, which is implemented to work with Version 1 of the COMPREDICT AI Core SDK for PHP and Laravel 5.x.
Installation
The COMPREDICT Service Provider can be installed via Composer by requiring the
compredict/ai-sdk-laravel
package in your project's composer.json
.
{ "require": { "compredict/ai-sdk-laravel": "dev-master" } }
Then run a composer update
php composer.phar update
To use the COMPREDICT Service Provider, you must register the provider when bootstrapping your application.
Lumen
In Lumen find the Register Service Providers
in your bootstrap/app.php
and register the COMPREDICT Service Provider.
$app->register(Compredict\Algorithm\CompredictServiceProvider::class);
Laravel
In Laravel find the providers
key in your config/app.php
and register the COMPREDICT Service Provider.
'providers' => array( // ... Compredict\Algorithm\CompredictServiceProvider::class, )
Find the aliases
key in your config/app.php
and add the COMPREDICT facade alias.
'aliases' => array( // ... 'CP_Algo' => Compredict\Algorithm\CompredictFacade::class, )
Configuration
By default, the package uses the following environment variables to auto-configure the plugin without modification:
COMPREDICT_AI_CORE_KEY=
COMPREDICT_AI_CORE_USER=
COMPREDICT_AI_CORE_CALLBACK=
COMPREDICT_AI_CORE_FAIL_ON_ERROR=true
COMPREDICT_AI_CORE_PPK=Path/to/PPK.pem
COMPREIDCT_AI_CORE_PASSPHRASE=
To customize the configuration file, publish the package configuration using Artisan.
php artisan vendor:publish --provider="Compredict\Algorithm\CompredictServiceProvider"
Update your settings in the generated app/config/compredict.php
configuration file.
Usage
In order to use the COMPREDICT's AI Core SDK for PHP within your app, you need to retrieve it from the Laravel IoC Container. The following example gets all the algorithms allowed for the user.
$algorithms = App::make('CP_Algo')->getAlgorithms();