1. Go to this page and download the library: Download bolzer/ts-const-enum 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/ */
bolzer / ts-const-enum example snippets
declare(strict_types=1);
use Bolzer\TsConstEnum\Configuration\Config;
return (new Config())
->setOutputPath(__DIR__ . '/generated/constants.ts')
;
declare(strict_types=1);
namespace Test\Example;
use Bolzer\TsConstEnum\Attributes\Constant;use Bolzer\TsConstEnum\Attributes\Enum;
class ExampleClass {
#[Constant(alias: "Test")]
private const TEST = "test";
#[Enum]
private const TEST_2 = [
self::TEST => "value"
];
}
class Membership {
public const FREE = "free";
public const PREMIUM = "premium";
public const TYPES = [
self::FREE,
self::PREMIUM
];
}