PHPackages                             linkorb/schemata - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. linkorb/schemata

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

linkorb/schemata
================

Schema tooling: modelling, documentation, generators, validators

v1.1.9(6y ago)01.2k[3 PRs](https://github.com/linkorb/schemata/pulls)PHP

Since May 31Pushed 2y ago1 watchersCompare

[ Source](https://github.com/linkorb/schemata)[ Packagist](https://packagist.org/packages/linkorb/schemata)[ RSS](/packages/linkorb-schemata/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (10)Versions (14)Used By (0)

LinkORB Schema Annotation Tool
==============================

[](#linkorb-schema-annotation-tool)

Installation
------------

[](#installation)

You can use the included generator tools using the following steps

- Make you have `composer` is installed ()
- Add the dependency: `composer require linkorb/schemata`
- Install the dependencies by running `composer install`. This will download all libraries we need in the `vendor/` subdirectory

Usage
-----

[](#usage)

### General CLI Usage

[](#general-cli-usage)

`vendor/bin/schemata  `

### Schema HTML documentation

[](#schema-html-documentation)

Type the following command to generate HTML documentation based on the schema files:

```
`vendor/bin/schemata generate:html-doc /path/to/schema /path/to/build/html-doc`

```

This will parse the schema defined in the `schema/` directory, and generate a complete set of HTML documentation in to the `build/html-doc` directory.

You can browse the documentation by opening the `index.html` file in a web-browser.

```
open `build/html-doc/index.html`

```

### GraphQL schema definitions

[](#graphql-schema-definitions)

Type the following command to generate [GraphQL schema definitions](https://graphql.org/learn/schema/) based on the schema files:

```
`vendor/bin/schemata generate:graphql-schema /path/to/schema /path/to/build/graphql [--bundle]`

```

This will parse the schema defined in the `schema/` directory, and generate a complete set of GraphQL types in to the `build/graphql` directory. Passing the `--bundle` flag will create a single bundled file instead of one per type

### Context schema definitions

[](#context-schema-definitions)

Type the following command to generate [context schema definitions](https://github.com/linkorb/context) based on the schema files:

```
`vendor/bin/schemata generate:context-schema /path/to/schema /path/to/build/context [--bundle]`

```

This will parse the schema defined in the `schema/` directory, and generate a complete set of GraphQL types in to the `build/context` directory. Passing the `--bundle` flag will create a single bundled file instead of one per type

### Schema Validation

[](#schema-validation)

```
`vendor/bin/schemata schemata:validate /path/to/schema`

```

A service that scans through all tables and columns, performs validation. The console command returns `0` if no issues, returns `-1` if issues exist.

### Schema Diff

[](#schema-diff)

```
`vendor/bin/schemata schemata:diff /path/to/schemaOne /path/to/schemaTwo`

```

A console command that:

- loads 2 schemas;
- scans throught all tables+columns, and build an array of differences (added+removed tables and columns);
- outputs the list of differences to the console.

### Inline Usage Example

[](#inline-usage-example)

```
