PHP code example of art4 / wegliphant

1. Go to this page and download the library: Download art4/wegliphant library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

art4 / wegliphant example snippets


$client = \Art4\Wegliphant\Client::create(
    new \GuzzleHttp\Client(),
    new \GuzzleHttp\Psr7\HttpFactory(),
);

$client->authenticate($apiKey);

$notices = $client->listOwnNotices();

// $notices contains:
[
    [...],
    [
        'token' => '8843d7f92416211de9ebb963ff4ce281',
        'status' => 'shared',
        'street' => 'Musterstraße 123',
        'city' => 'Berlin',
        'zip' => '12305',
        'latitude' => 52.5170365,
        'longitude' => 13.3888599,
        'registration' => 'EX AM 713',
        'color' => 'white',
        'brand' => 'Car brand',
        'charge' => [
            'tbnr' => '141312',
            'description' => 'Sie parkten im absoluten Haltverbot (Zeichen 283).',
            'fine' => '25.0',
            'bkat' => '§ 41 Abs. 1 iVm Anlage 2, § 49 StVO; § 24 Abs. 1, 3 Nr. 5 StVG; 52 BKat',
            'penalty' => null,
            'fap' => null,
            'points' => 0,
            'valid_from' => '2021-11-09T00:00:00.000+01:00',
            'valid_to' => null,
            'implementation' => null,
            'classification' => 5,
            'variant_table_id' => 741017,
            'rule_id' => 39,
            'table_id' => null,
            '

$notice = $client->getNoticeByToken('8843d7f92416211de9ebb963ff4ce281');

// $notice contains:
[
    'token' => '8843d7f92416211de9ebb963ff4ce281',
    'status' => 'shared',
    'street' => 'Musterstraße 123',
    'city' => 'Berlin',
    'zip' => '12305',
    'latitude' => 52.5170365,
    'longitude' => 13.3888599,
    'registration' => 'EX AM 713',
    'color' => 'white',
    'brand' => 'Car brand',
    'charge' => [
        'tbnr' => '141312',
        'description' => 'Sie parkten im absoluten Haltverbot (Zeichen 283).',
        'fine' => '25.0',
        'bkat' => '§ 41 Abs. 1 iVm Anlage 2, § 49 StVO; § 24 Abs. 1, 3 Nr. 5 StVG; 52 BKat',
        'penalty' => null,
        'fap' => null,
        'points' => 0,
        'valid_from' => '2021-11-09T00:00:00.000+01:00',
        'valid_to' => null,
        'implementation' => null,
        'classification' => 5,
        'variant_table_id' => 741017,
        'rule_id' => 39,
        'table_id' => null,
        '

$districts = $client->listDistricts();

// $districts contains:
[
    [...],
    [
        'name' => 'Berlin',
        'zip' => '12305',
        'email' => '[email protected]',
        'prefixes' => [
            'B',
        ],
        'latitude' => 52.5170365,
        'longitude' => 13.3888599,
        'aliases' => null,
        'personal_email' => false,
        'created_at' => '2019-09-24T14:56:35.624+02:00',
        'updated_at' => '2020-03-06T17:53:09.034+01:00',
    ],
    [...],
],

$district = $client->getDistrictByZip('12305');

// $district contains:
[
    'name' => 'Berlin',
    'zip' => '12305',
    'email' => '[email protected]',
    'prefixes' => [
        'B',
    ],
    'latitude' => 52.5170365,
    'longitude' => 13.3888599,
    'aliases' => null,
    'personal_email' => false,
    'created_at' => '2019-09-24T14:56:35.624+02:00',
    'updated_at' => '2020-03-06T17:53:09.034+01:00',
],

$charges = $client->listCharges();

// $charges contains:
[
    [...],
    [
        'tbnr' => '141313',
        'description' => 'Sie parkten im absoluten Haltverbot (Zeichen 283) und behinderten +) dadurch Andere.',
        'fine' => '40.0',
        'bkat' => '§ 41 Abs. 1 iVm Anlage 2, § 1 Abs. 2, § 49 StVO; § 24 Abs. 1, 3 Nr. 5 StVG; 52.1 BKat; § 19 OWiG',
        'penalty' => null,
        'fap' => null,
        'points' => 0,
        'valid_from' => '2021-11-09T00:00:00.000+01:00',
        'valid_to' => null,
        'implementation' => 2,
        'classification' => 5,
        'variant_table_id' => 741017,
        'rule_id' => 39,
        'table_id' => null,
        '

$charge = $client->getChargeByTbnr('141313');

// $charge contains:
[
    'tbnr' => '141313',
    'description' => 'Sie parkten im absoluten Haltverbot (Zeichen 283) und behinderten +) dadurch Andere.',
    'fine' => '40.0',
    'bkat' => '§ 41 Abs. 1 iVm Anlage 2, § 1 Abs. 2, § 49 StVO; § 24 Abs. 1, 3 Nr. 5 StVG; 52.1 BKat; § 19 OWiG',
    'penalty' => null,
    'fap' => null,
    'points' => 0,
    'valid_from' => '2021-11-09T00:00:00.000+01:00',
    'valid_to' => null,
    'implementation' => 2,
    'classification' => 5,
    'variant_table_id' => 741017,
    'rule_id' => 39,
    'table_id' => null,
    '
bash
docker compose build
docker compose up -d
docker compose exec php php --version
bash
docker compose exec php composer test
bash
docker compose exec php composer phpstan
docker compose exec php composer phpunit
docker compose exec php composer codestyle