Skip to content

Latest commit

 

History

History
82 lines (55 loc) · 2.21 KB

INSTALLATION.md

File metadata and controls

82 lines (55 loc) · 2.21 KB

InterFAX PHP Library

This file provides more detail as to how to install the Interfax PHP library in a project.

Standard installation

The standard approach is to use the composer dependency manager to add the library to your project requirements:

composer require interfax/interfax

Standalone installation

Many projects may not use composer to manage their dependencies. In these circumstances, it's possible to include the library as a self contained dependency. The following steps will allow you to do this.

  1. Clone the Interfax PHP repo into your project.
  2. Inside the Interfax PHP directory, download composer.
  3. Run composer to download the dependencies for the Interfax library.
  4. Back in your main project file(s), include the autoload file generated by composer to include the library and its dependencies.
  5. Follow the documentation to use the library as normal.

Example project

Assuming a simple project for Acme Corp that consists of a single index.php file.

Download the library

cd acme-corp
git clone https://github.com/interfax/interfax-php.git
cd interfax-php

Setup Composer

Assuming composer is not already installed globally, install it into a bin directory.

mkdir bin

Note the composer site has more detailed instructions for installation, the following is a small simplification

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --install-dir=bin
php -r "unlink('composer-setup.php');"

Download dependencies

Simply run the install command to download the dependencies

php ./bin/composer.phar install --no-dev

The 'no-dev' option prevents the testing dependencies for the library from being installed to save space/bandwidth

Use the library

inside acme-corp/index.php

require_once(__DIR__ . '/interfax-php/vendor/autoload.php');

use Interfax\Client;

$interfax = new Client(['username' => 'username', 'password' => 'password']);
// etc

Deployment

When it comes to deploying the project, the following paths will be required:

acme-corp/interfax-php/src/
acme-corp/interfax-php/vendor/

The rest of the files can safely be ignored.