Skip to content

Various tools to generate a data model based on Schema.org vocables

License

Notifications You must be signed in to change notification settings

jaymecd/php-schema.org-model

 
 

Repository files navigation

PHP Schema.org Model

Various tools to generate a data model based on Schema.org vocables.

This project is a work in progress. It is not ready to production yet.

Build Status

Installation

Use Composer.

composer require dunglas/php-schema.org-model

Doctrine entities generator

Generates Doctrine entities from Schema.org vocables.

Usage:

php vendor/bin/schema.php my-output-directory/ [config.yml]

Configuration

See lechoppe.yml file.

Configuration reference

# Debug mode
debug:                false

# Use Doctrine's Resolve Target Entity feature
useRte:               false

# Emit a warning if a property is not derived from GoodRelations
checkIsGoodRelations:  false

# A license or any text to use as header of generated files
header:               false # Example: // (c) Kévin Dunglas <[email protected]>

# PHP namespaces
namespaces:

    # The namespace of the generated entities
    entity:               SchemaOrg\Entity # Example: Acme\Entity

    # The namespace of the generated enumerations
    enum:                 SchemaOrg\Enum # Example: Acme\Enum

    # The namespace of the generated interfaces
    interface:            SchemaOrg\Model # Example: Acme\Model

# The value of the phpDoc's @author annotation
author:               false # Example: Kévin Dunglas <[email protected]>

# Visibility of entities fields
fieldVisibility:      ~ # One of "private"; "protected"; "public"

# Schema.org's types to use
types:

    # Prototype
    id:
        doctrine:

            # The Doctrine inheritance mapping type
            inheritanceMapping:   null

        # The parent class
        parent:               null

        # Properties of this type to use
        properties:

            # Prototype
            id:

                # The property range
                range:                null # Example: Offer
annotationGenerators:

    # Defaults:
    - SchemaOrgModel\AnnotationGenerator\PhpDocAnnotationGenerator
    - SchemaOrgModel\AnnotationGenerator\ConstraintAnnotationGenerator
    - SchemaOrgModel\AnnotationGenerator\DoctrineAnnotationGenerator

Cardinalities extractor

Extracts property's cardinality. GoodRelations data are used when applicable. Other cardinalities are guessed using the property's comment. When the cardinality cannot be automatically extracted, it's value is set to unknown.

Usage:

php vendor/bin/schema.php schema:extract-cardinalities

About

Various tools to generate a data model based on Schema.org vocables

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published