mjaschen/bezahlcode

BezahlCode Generator Library

Installs: 25

Dependents: 0

Stars: 3

Watchers: 2

Forks: 1

Language: PHP

1.0.1 2014-04-07 11:42 UTC

README

Build Status Latest Stable Version

Introduction

BezahlCode is a PHP library for creating BezahlCode QR-Code images and URIs.

Table of Contents

Installation

BezahlCode is installed via Composer:

Just add it to your composer.json by running (preferred method):

composer require mjaschen/bezahlcode

Or add it manually to your composer.json (legacy method):

{
    "require": {
        "mjaschen/bezahlcode": "~1.0"
    }
}

Usage

SEPA Transfer

Output a BezahlCode image directly to the browser:

<?php

use MarcusJaschen\BezahlCode\Type\SepaTransfer;

$bezahlCode = new SepaTransfer();

$bezahlCode->setTransferData(
    "Marcus Jaschen",
    "DE12345678901234567890",
    "SPARDEFFXXX",
    99.99,
    "Test SEPA Transfer"
);

header('Content-type: image/png');
echo $bezahlCode->getBezahlCode();

Save a BezahlCode image to a file:

<?php

use MarcusJaschen\BezahlCode\Type\SepaTransfer;

$bezahlCode = new SepaTransfer();

$bezahlCode->setTransferData(
    "Marcus Jaschen",
    "DE12345678901234567890",
    "SPARDEFFXXX",
    99.99,
    "Test SEPA Transfer"
);

$file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . "bezahlcode_test.png";

$bezahlCode->saveBezahlCode($file);

Get BezahlCode URI:

<?php

use MarcusJaschen\BezahlCode\Type\SepaTransfer;

$bezahlCode = new SepaTransfer();

$bezahlCode->setTransferData(
    "Marcus Jaschen",
    "DE12345678901234567890",
    "SPARDEFFXXX",
    99.99,
    "Test SEPA Transfer"
);

echo $bezahlCode->getBezahlCodeURI();

Classic Transfer

Output a BezahlCode image directly to the browser:

<?php

use MarcusJaschen\BezahlCode\Type\Transfer;

$bezahlCode = new Transfer();

$bezahlCode->setTransferData(
    "Marcus Jaschen",
    "1234567890",
    "10050000",
    99.99,
    "Test Classic Transfer"
);

header('Content-type: image/png');
echo $bezahlCode->getBezahlCode();

Saving a BezahlCode to a file and getting the BezahlCode URI works as described in the SEPA Transfer section.

Other Types

  • Periodic Transfer
  • Periodic SEPA Transfer
  • Direct Debit
  • SEPA Direct Debit

Bugs / To Do

  • TODO: implement missing authorities (contact, contactv2)
  • TODO: write more Tests

Credits