php-payment-api Installation

Introduction

This article describes the steps needed to install the heidelpay php-payment-api.

The php-payment-api is build as a composer library, therefore the easiest way to use it is to install it by using composer.

What is composer and how to use it?

composer is a package dependency manager for php. You may know linux package managers like APT for Ubuntu or Debian, composer is the same for your php project.

composer has two main advantages. The first one is it’s easy to use and the second one is that it has a build in an auto loader. We will cover this later in this section.

Can I use heidelpay php-payment-api without compser?

Yes, but you have to build your own autoloader. You can get the php-payment-api
directly from github.

Add a composer.json to your application.

You project already uses composer ? Then you can go ahead to the next section.

For the rest of you, we will make a quick guide.

We will not cover the installation of composer here, because this depends on your operation system, so please have a look on the composer website for this.

composer is a command-line tool so please use the command-line of your operation system. Now please navigate to the root of your project and typ:

composer init

Now you have to answer a few question like package name,  description, author, minimum stability, packages type and license. The only necessary one is package name.

The last questions are:
Would you like to define your dependencies (require) interactively?
Would you like to define your dev dependencies (require-dev) interactively?

You can skip this by type no.
Do you confirm generation?
Please answer this with yes and now your project has a compser.json file, like this one:

{ “name”: “myproject/shop-abc”, “type”: “project”, “require”: {} }

Add heidelpay php-payment-api to your project

The heidelpay php-payment-api is now available over  packagist.org , so you can add it by typing:

composer require "heidelpay/php-payment-api:dev-master"

The term dev-master will always be the latest stabile version. For your application it would be better to use a static version for like example 1.4.0.

Currently the newest version is heidelpay/php-payment-api current version.

Why is it better to use a static version?

For development it’s okay to use dev-master or even dev-develop. Every time you type composer update, you will get the latest stable version from heidelpay github account.

But for production it is better to stick with a static version. Maybe there will be changes on the library in future which change behaviors that your application depends on.

In such a case it is better to build your application against a static version in case you need to update the library then for whatever reason. Just edit the comser.json and change the version number and call composer update. Please test your application on weather everything works as expected with the new version or not.

Where to find the version information?

You can find the latest version on heidelpay/php-payment-api current version.

If you need more informations about the changes please have a look at the github release notes.

How to continue after installation?

Find out how to use the php-payment-api by progressing to our quick start guide.