PHP code example of edin / entityparser

1. Go to this page and download the library: Download edin/entityparser 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/ */

    

edin / entityparser example snippets



ntityParser\Parser\Parser;
use EntityParser\Parser\Contract\CodeModelInterface;

$parser = new Parser();
$codeModel = $parser->parse(file_get_contents("Blog.edf"));

/**
 * @var CodeModelInterface $codeModel
 */
$entities  = $codeModel->getEntities();
$types     = $codeModel->getTypes();
$constants = $codeModel->getConstants();
 

php demo.php parse Blog --php

class User
{
  public $Id;
  public $FirstName;
  public $LastName;
  public $Email;
  public $UserName;
  public $PasswordHash;
  public $Modified;
  public $Created;
}

class Comment
{
  public $Id;
  public $UserId;
  public $PostId;
  public $Text;
  public $Modified;
  public $Created;
}

class Post
{
  public $Id;
  public $UserId;
  public $Title;
  public $Content;
  public $Modified;
  public $Created;
}
cmd
php demo.php parse Blog --const

Constants:
  Constant: unitNamespace = app\data
  Constant: unitDir = blog
  Constant: unitName = BlogDbContext