How to use the Bot Libre PHP SDK |
Setting up PHP for Windows
To enable PHP to work properly in Windows, we must edit the system environment variables and set the PATH accordingly:
Configure PHP: After installation, you may need to configure PHP according to your system requirements. This involves editing the php.ini file to enable or disable certain features, set memory limits, and configure database settings.Changes to php.iniThere have been some changes made in the 'php.ini' file. This file is used to configure the PHP environment and the changes made to it are described below.The following changes have been made to the php.ini file:
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo = "D:\php-8.2.3\cacert.pem"
[openssl]
; The location of a Certificate Authority (CA) file on the local filesystem
; to use when verifying the identity of SSL/TLS peers. Most users should
; not specify a value for this directive as PHP will attempt to use the
; OS-managed cert stores in its absence. If specified, this value may still
; be overridden on a per-stream basis via the "cafile" SSL stream context
; option.
openssl.cafile="D:\php-8.2.3\cacert.pem"
The cacert.pem file is often used in PHP projects to provide a set of trusted root certificates that can be used by the curl library (which is commonly used for making HTTPS requests).
Before starting the PHP server, we will need to edit the index.php file located in the Bot Libre PHP SDK.
public static string $applicationId = ""; //Application id
/**
* Enter your account details. Both your username and password are required.
* If you don't have an account yet, you can create one to use.
*/
public static string $username = "";
public static string $password = "";
Once that’s done, we need to start up the PHP server. Open the Command Prompt on Windows. Navigate to the directory where the Bot Libre PHP SDK is located. For example, if the Bot Libre PHP SDK is located in the "D:\php-8.2.3" directory, you can navigate to that directory by typing "cd D:\php-8.2.3" and pressing Enter. Once you are in the PHP SDK directory, you can start the PHP development server by typing the following command:
php -S localhost:8000
This will start the PHP development server on your computer, listening on port 8000. You can then access your PHP application by navigating to "http://localhost:8000";. |
|
|
|
|