PHP Basket API Installation

heidelpay PHP-Basket-API installation

The php-basket-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 the heidelpay php-basket-api without compser?

Yes, but you have to build your own autoloader. You can get the php-basket-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 type:

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 the Basket API to your project

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

composer require "heidelpay/php-basket-api"

The latest stable version is heidelpay php-basket-api latest stable version.

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