fraktjakt / library
PHP integration library for Fraktjakt API.
Requires
- php: >=5.4
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-10-11 20:34:45 UTC
README
This is a PHP library for machine-to-machine communication with Fraktjakt.
Use With Composer
(We will just assume you have composer installed for your project)
-
Open a command-line interface and navigate to your project folder.
-
Run the following command in your command-line interface:
composer require fraktjakt/library:dev-master
Composer will now autoload Client.php when you create the class object:
$fraktjakt = new \Fraktjakt\Client();
Use Without Composer
Manually include Client.php in your script before initiating the client.
require_once 'path/to/Client.php';
$fraktjakt = new \Fraktjakt\Client();
Example Code (More examples in the examples/ folder)
require_once 'path/to/Client.php';
try {
$fraktjakt = new \Fraktjakt\Client();
$fraktjakt->setConsignorId(12345)
->setConsignorKey('0123456789abcdef0123456789abcdef')
->setTestMode(true);
$request = array(
// ...
);
$result = $fraktjakt->Query($request);
} catch(Exception $e) {
die('An error occured: '. $e->getMessage() . PHP_EOL . PHP_EOL
. $fraktjakt->getLastLog());
}
Testing
-
Make sure you have PHP installed on your machine.
-
Open a command-line interface and navigate to the examples/ folder.
-
Run the following command in your command-line interface:
php ExampleFile.php