Giter VIP home page Giter VIP logo

php-message-code-mapper's Introduction

Codacy Badge Codacy Badge Build Status Latest Stable on Packagist PHP 5.6 PHP 7.0 PHP 7.1 PHP 7.2

Logo

heidelpay message code mapper

This library provides user-friendly output of (error)-messages coming from the heidelpay API.

1. Installation

Composer

composer require heidelpay/php-message-code-mapper

manual Installation

Download the latest release from github and unpack it into a folder of your choice inside your project.

2. Implementation

Composer

require_once 'path/to/autoload.php;
use Heidelpay\MessageCodeMapper\MessageCodeMapper;

manual Installation

require_once 'path/to/php-message-code-mapper/lib/MessageCodeMapper.php';

Of course, the path needs to match the path from step 1.

3. Usage

Assuming you have received an error code from one of our modules or the heidelpay PHP API and stored it in a variable called $errorcode. To get a message from that code, create a MessageCodeMapper instance:

$instance = new \Heidelpay\MessageCodeMapper\MessageCodeMapper('de_DE');

The constructor takes two (optional) arguments:

  1. The locale (e.g. 'en_US', 'de_DE')
  2. The path to the locales path (for example you want to use your own locale files) containing the .csv files with the codes and messages.

We provide 'de_DE' and 'en_US' locale files with this package. You can find them in the lib/locales folder. If you want to use one of these, the path doesn't need to be provided in the constructor.

By default, 'en_US' is used as the locale.

Now you can return or print out the message by calling the getMessage() method:

return $instance->getMessage($errorcode); echo $instance->getMessage($errorcode);

Error codes are accepted in either the 'XXX.XXX.XXX' or 'HP-Error-XXX.XXX.XXX' format.

Support

For any issues or questions please get in touch with our support.

Web page

https://dev.heidelpay.com/

Email

[email protected]

Phone

+49 (0)6221/6471-100

Twitter

@devHeidelpay

php-message-code-mapper's People

Contributors

bkonetzny avatar devheidelpay avatar frostblognet avatar ryouzanpaku avatar stevenobird avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.