Skip to content

Latest commit

 

History

History
46 lines (36 loc) · 1.11 KB

php.md

File metadata and controls

46 lines (36 loc) · 1.11 KB

Pocoglot - PHP

Pocoglot is a simple command line application that takes an entity definition file and generates code in one of many supported languages. If you are writing multi-tier applications in multiple languages this tool can save you from a lot of repeated typing and out-of-sync models.

Usage example

Create definition file vulnerability.yaml:

name: Vulnerability
props:
  - name: id
    type: integer
  - name: severity
    type: float

Invoke command to generate vulnerability.php:

$ ./main.py -from vulnerability.yaml -to vulnerability.php -lang php8
18:00:12.019 INFO Generating code in "php8" from "vulnerability.yaml" to "vulnerability.php"
18:00:12.025 INFO Done!

The file vulnerability.php now contains:

<?php declare(strict_types=1);

/**
 * Autogenerated model, do not edit manually.
 */
class Attachment {

	public ?int $id = null;
	public string $parent_type;
	public int $parent_id;
	public int $submitter_uid;
	public string $client_file_name;
	public string $file_name;
	public int $file_size;
	public ?string $file_mimetype;
	public string $file_hash;
}