Installation

What are the requirements and dependencies and how do you install Phapi?

System requirements

  • Web server with URL rewriting
  • PHP 5.6 or newer

Phapi might work on earlier versions but it's not tested nor is it supported on earlier versions. Phapi is currently tested on PHP 5.6, PHP 7 and HHVM. The default configuration works on all three versions but there are individual extra packages that does not support all versions.

Here is a current list of packages with tests that does not pass on one or more versions:

Dependencies

There is one dependency with the basic configuration.

There are however features and middleware that do have some other dependencies. A list of these dependencies can be found here:

PHP settings

It's suggested to turn off displaying of errors in production environments and rely on logging instead since Phapi has an error handler that will display serialized error messages.

During development it's beneficial however to display errors and setting error reporting to E_ALL.

Install with configuration (recommended)

The phapi/phapi-configuration project includes everything you need to set up a simple hello world example. Download the latest version of the package and extract it to an empty directory. This zip file includes all the default configuration. After you've extracted the zip file you need to run composer:

$ composer install

Install via Composer

It is also possible to install Phapi by using Composer. Navigate to your project directory and execute the following bash command. This command will install the Phapi Framework and all dependencies into your project's vendor/ directory. You will however have to manually handle the configuration.

$ composer require phapi/phapi

Next, require the Composer autoloader into your PHP script.

<?php
require 'vendor/autoload.php';