mvccore / ext-tool-ts-generator
MvcCore - Extension - Tool - TypeScript Generator - utility to easilly generate TypeScript classes, interfaces or enums from PHP equivalents.
v5.3.0
2024-11-21 15:01 UTC
Requires
- php: >=5.4.0
- mvccore/mvccore: ^5.3
Requires (Dev)
- php: >=5.4.0
- nette/tester: <=2.4
- tomflidr/tracy: <=2.5.13
README
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();