Skip to content

Installation

  1. Requirements
  2. PHAR
  3. Docker
  4. Phive
  5. Composer
  6. Git
  7. Database

Requirements

  • PHP 8.0 or greater
  • ext-json
  • ext-pcre (required by: bartlett/php-compatinfo-db)
  • ext-pdo (required by: bartlett/php-compatinfo-db)
  • ext-spl
  • PHPUnit 9 or greater (if you want to run unit tests)

PHAR

The preferred method of installation is to use the CompatInfo PHAR version which can be downloaded from the most recent GitHub Release. This method ensures you will not have any dependency conflict issue.

Docker

Retrieve official image with Docker

docker pull ghcr.io/llaville/php-compatinfo:v7
or
docker pull ghcr.io/llaville/php-compatinfo:latest

Phive

You can install application globally with Phive

phive install llaville/php-compatinfo --force-accept-unsigned

To upgrade global installation of the application use the following command:

phive update llaville/php-compatinfo --force-accept-unsigned

You can also install application locally to your project with Phive and configuration file .phive/phars.xml

<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
    <phar name="llaville/php-compatinfo" version="^7.1" copy="false" />
</phive>
phive install --force-accept-unsigned

Composer

The recommended way to install this library is through composer. If you don't know yet what is composer, have a look on introduction.

composer require bartlett/php-compatinfo ^7.1

If you cannot install it because of a dependency conflict, or you prefer to install it for your project, we recommend you to take a look at bamarni/composer-bin-plugin. Example:

composer require --dev bamarni/composer-bin-plugin
composer bin phpcompatinfo require --dev bartlett/php-compatinfo

vendor/bin/phpcompatinfo

Git

The PHP CompatInfo can be directly used from GitHub by cloning the repository into a directory of your choice.

git clone -b 7.1 https://github.com/llaville/php-compatinfo.git

Configuring the Database

The database connection information is stored as an environment variable called DATABASE_URL.

# to use mysql:
DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"

# to use mariadb:
DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=mariadb-10.5.8"

# to use sqlite:
DATABASE_URL="sqlite:///%kernel.cache_dir%/compatinfo-db.sqlite"

# to use postgresql:
DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8"

After installation, or if you change database connection, you have to run following command(s):

  • bin/phpcompatinfo db:create
  • bin/phpcompatinfo db:init

At first run of CompatInfo, DATABASE_URL will be set to use default SQLite connection