1. Go to this page and download the library: Download krak/adt 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/ */
krak / adt example snippets
use Krak\ADT\ADT;
/**
* @method static Upc upc(int $numberSystem, int $manufacturer, int $product, int $check)
* @method static QrCode qrCode(string $productCode)
*/
abstract class Barcode extends ADT {
public static function types(): array {
return [Upc::class, QrCode::class];
}
}
final class Upc extends Barcode {
public $numberSystem;
public $manufacturer;
public $product;
public $check;
public function __construct(int $numberSystem, int $manufacturer, int $product, int $check) {
$this->numberSystem = $numberSystem;
$this->manufacturer = $manufacturer;
$this->product = $product;
$this->check = $check;
}
}
final class QrCode extends Barcode {
public $productCode;
public function __construct(string $productCode) {
$this->productCode = $productCode;
}
}
$barcode = new QrCode('abc123');
//