Download the PHP package riverwaysoft/php-converter without Composer
On this page you can find all versions of the php package riverwaysoft/php-converter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download riverwaysoft/php-converter
More information about riverwaysoft/php-converter
Files in riverwaysoft/php-converter
Package php-converter
Short Description PHP converter to TypeScript / Dart
License GPL-3.0-or-later
Informations about the package php-converter
php-converter
Generates TypeScript & Dart out of your PHP DTO classes.
Why?
Statically typed languages like TypeScript or Dart are great because they allow catching bugs without even running your code. But unless there are well-defined contracts between the API and consumer apps, you may find yourself frequently adjusting outdated typings whenever the API changes. This library generates types for you, enabling you to move faster and encounter fewer bugs.
Requirements
PHP 8.0 or above
Quick start
1) Installation
If the installation leads to dependency conflicts, consider using the standalone Phar version of the package.
2) Mark a few classes with the #[Dto] annotation to convert them into TypeScript or Dart.
4) Run the CLI command to generate TypeScript
This will generate a file generated.ts
with the following content:
Features
- Supports all PHP data types including union types, nullable types, and enums.
- Supports PHP DocBlock types, e.g.,
User[]
,int[][]|null
, and generics thanks to phpstan/phpdoc-parser - Custom type resolvers (for instance, for
DateTimeImmutable
). - Generate a single output file or multiple files (1 type per file).
- Option to override the generation logic.
- Flexible class filters with the option to use your own filters.
- Generate API client from Symfony or API Platform code.
Customization
If you'd like to customize the conversion process, you need to copy the config script to your project folder:
Now you can customize this config and run the php-converter using the following script:
Documentation
- Class filtering
- Customize output
- Unknown type resolvers
- Other languages support
- Troubleshooting
- Development
- Standalone installation
All versions of php-converter with dependencies
nikic/php-parser Version ^4.16
webmozart/assert Version ^1.10
jfcherng/php-diff Version ^6.10
jawira/case-converter Version ^3.4
phpstan/phpdoc-parser Version ^1.6
doctrine/inflector Version ^2.0
composer/xdebug-handler Version ^3.0
symfony/console Version ^5.3|^6.3|^6.2|^6.1|^7.0
symfony/filesystem Version ^5.3|^6.3|^6.2|^6.1|^7.0
symfony/process Version ^5.3|^6.3|^6.2|^6.1|^7.0