Skip to content

mvccore/ext-tool-ts-generator

Repository files navigation

MvcCore - Extension - Tool - TypeScript Generator

Latest Stable Version License PHP Version

Installation

composer require mvccore/ext-tool-ts-generator

Features

Extension to easilly generate TypeScript model classes, interfaces or enums from PHP equivalents.

Usage

<?php

include_once('vendor/autoload.php');

use \MvcCore\Ext\Tools\TsGenerator;

TsGenerator::CreateInstance()
	->SetType(
		new \ReflectionClass(\PhpObjects\BaseClass::class)
	)
	->SetPropsFlags(
		TsGenerator::PROPS_INHERIT_PROTECTED
	)
	->SetTargetPath(
		__DIR__ . '/Ts/Custom/ClassName.d.ts'
	)
	->SetWriteFlags(
		TsGenerator::WRITE_INTERFACE
		| TsGenerator::WRITE_DECLARE
		// | TsGenerator::WRITE_EXPORT
	)
	->SetExcludedPropsNames(['db'])
	//->SetCustomName('Custom.ClassName')
	->Parse()
	->Write();

About

Utility to easilly generate TypeScript classes, interfaces or enums from PHP equivalents.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages