Installation of PHP SDK

Installation of PHP SDK

The PageSense PHP SDK empowers developers to integrate, run, and analyze Full Stack A/B tests directly from their PHP applications. It offers a simple, secure, and reliable way to connect your PHP applications to the PageSense’s experimentation platform, allowing you to evaluate variations, personalize user experiences, and track conversions in real time.

What the PHP SDK allows you to do  

  • Add A/B Test experimentation to your PHP application with minimal setup.

  • Handle all the communication with the PageSense REST APIs securely using HTTPS.

  • Automatically fetch and cache project settings to keep the experiments in sync.

  • Capture and send visit and goal events (engagements, conversions, interactions) instantly.

  • Store and use the user attributes for audience targeting and report segmentation.

How it works  

PageSense PHP SDK acts as a lightweight communication layer between your PHP application and PageSense’s FullStack experimentation platform. Once initialized, it can:

  • Fetch all active experiments associated with your project.

  • Determine which variation should be served for each user or session.

  • Track visits and conversions and send the real-time metrics back to PageSense for analysis.

This ensures that your server logic stays consistent with your PageSense experiment setup and that experiment results reflect real-world usage accurately.

Installation  

PageSense PHP SDK can be installed in your PHP application via Composer, the standard dependency manager for PHP.
  1. Install Composer

a. To install the Composer in Windows machine, run the following PowerShell commands.

  1. php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  2. php composer-setup.php --install-dir=C:\composer --filename=composer.phar
  3. php -r "unlink('composer-setup.php');"

b. To install the Composer in Mac/Linux machine, run the following commands in Terminal.

  1. curl -sS https://getcomposer.org/installer -o composer-setup.php
  2. sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
  3. rm composer-setup.php
  1. Install PageSense PHP SDK

Run the following command in your Project root folder to install the PageSense PHP SDK

  1. composer require zoho/zpagesense-php-sdk

If you prefer to integrate the PageSense PHP SDK manually, you can download the package from the link and include it in your application -: PHP SDK.


Requirements  

  • PHP 8.1 or above

 

We hope this documentation helps make the process easy for you. Please feel free to reach out to us anytime by dropping an email to support@zohopagesense.com if you need more explanation or have any questions.