PHP code example of paneon / php-to-typescript-bundle
1. Go to this page and download the library: Download paneon/php-to-typescript-bundle 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/ */
paneon / php-to-typescript-bundle example snippets
use Paneon\PhpToTypeScript\Attribute\TypeScript;
#[TypeScript]
class Example
{
public string $firstName;
public ?string $middleName;
public string $lastName;
public ?int $age;
/** @var Contact[] */
public array $contacts;
}
use Paneon\PhpToTypeScript\Attribute\TypeScript;
#[TypeScript]
class User
{
public string $name;
public Address $address;
}
use Paneon\PhpToTypeScript\Attribute\TypeScript;
#[TypeScript]
enum Status: string
{
case Active = 'active';
case Inactive = 'inactive';
case Pending = 'pending';
}