I assume that your web server is running PHP on Linux – in this guide, we will cover both Debian/Ubuntu as well as CentOS distros. What we will need to do is to install Composer, which is a dependency manager for PHP. Then we can install the Google API client to be able to perform API calls to GSheets to pull data from there.
- Verify that your PHP version is in the minimum required supported version of PHP, as Gravity Forms follow that.
jan@entelechia:~$ php -v
PHP 7.3.14-1~deb10u1 (cli) (built: Feb 16 2020 15:07:23) ( NTS )
Copyright (c) 1997-2018 The PHP Group
- Update your OS,, verify/update your PHP-JSON library + Composer requirements.
# CentOS:
sudo yum update
sudo yum install php-json php-cli curl
# Debian/Ubuntu:
sudo apt update && sudo apt upgrade
sudo apt-get install php-json php-cli curl -y
- Install Composer. If you are running on a test web server, you can switch over to the ‘root’ account by running ‘sudo su’, but this is not a recommended practice in any production system.
mkdir -p /tmp/composer
cd /tmp/composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
- Verify that Composer can be queried. It is not recommended to run Composer from a root account.
jan@entelechia:/tmp/composer/$ composer -V
Composer version 2.0.11 2021-02-24 14:57:23
- Install the required library for Google client API.
- Note: It is possible to just to download the API Client from Github and unzip it into a folder that you will be using. But if you do that, Composer will not be actively maintaining it for you. This approach is only recommended if there is an important bug fix that is only available in the version history system but not yet pushed into Composer.
- Check what is the current newest version of the API Client – e.g. 2.9.1
jan@entelechia:/tmp/composer$ composer require google/apiclient:^2.9.1
6. Note that a folder called ‘vendor’ is created with some other library folders such as ‘firebase’, ‘guzzlehttp’ and ‘google’. This is what we will need for the next step.
jan@entelechia:/tmp/composer$ ls vendor/
autoload.php composer firebase google guzzlehttp monolog paragonie phpseclib psr ralouphie
Sources: