PHPackages                             edin/entityparser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. edin/entityparser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

edin/entityparser
=================

Parser for entity definition files

v1.0.1(5y ago)016[1 PRs](https://github.com/edin/entityparser/pulls)PHPPHP ^7.0|^8.0CI failing

Since Jun 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/edin/entityparser)[ Packagist](https://packagist.org/packages/edin/entityparser)[ RSS](/packages/edin-entityparser/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

About
=====

[](#about)

Parser for simple entity definition file.

Definition file example:

```
const unitNamespace = "app\data";
const unitDir       = "blog";
const unitName      = "BlogDbContext";

@PK type UserId     int;
@PK type CommentId  int;
@PK type PostId     int;

@Unique
type Email         string(100);

type ShortString   string(100);
type LongString    string(500);
type DateModified  date;
type DateCreated   date;
type PasswordHash  string(100);

entity User {
    UserId        Id;
    ShortString   FirstName;
    ShortString   LastName;
    Email         Email;
    ShortString   UserName;
    ShortString   PasswordHash;
    DateModified  Modified;
    DateCreated   Created;
}

entity Comment {
    CommentId     Id;
    UserId        UserId;
    PostId        PostId;
    Text          Text;
    DateModified  Modified;
    DateCreated   Created;
}

entity Post {
    PostId        Id;
    UserId        UserId;
    ShortString   Title;
    Text          Content;
    DateModified  Modified;
    DateCreated   Created;
}

```

Following snipet demonstrates how to load definition file.

```
