Download the PHP package beastbytes/schema-dot-org-helper without Composer

On this page you can find all versions of the php package beastbytes/schema-dot-org-helper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package schema-dot-org-helper

Schema.org Helper (schema-dot-org-helper)

A Helper for generating Schema.org schemas in JSON-LD.

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json.

Usage

To generate a schema:

The generated schema can be rendered directly

or registered with the view:

Defining a Schema Mapping

A schema mapping is an array that defines the mapping of model properties to Schema.org properties; it is of the form:

Where a Schema.org property is defined as a Schema.org type, the type is a nested array:

If a Schema.org property is to be a string literal, prepend with SchemaDotOrg::STRING_LITERAL :

If a Schema.org property is a SchemaDotOrg Enumeration value, prepend with SchemaDotOrg::ENUMERATION :

If a Schema.org property is an array of values - usually nested types - specify the mapping as an array. The key must be or start with SchemaDotOrg::ARRAY. If it is just SchemaDotOrg::ARRAY the mapping parent key is the model property, else the model property is the remainder of the key; both forms are shown below:

Example schema mapping definition:

Example JSON-LD generated using the above schema mapping:

Twig Templates

To use the helper in a Twig templates either include it in CommonViewInjection (in the examples it is assigned to the schemaDotOrg variable) or in the template

Then in the template either:

to echo the schema immediately:

or to register the schema with the view:

Defining the Mapping

For example:

Testing

All testing is carried out from the root directory.

Unit testing

The package is tested with PHPUnit. To run tests: composer test

Mutation testing

The package tests are checked with Infection mutation framework with Infection Static Analysis Plugin. To run it: composer infection

Static analysis

The code is statically analyzed with Psalm. To run static analysis: composer psalm

License

The Schema.org Helper is free software. It is released under the terms of the BSD License. Please see LICENSE for more information.


All versions of schema-dot-org-helper with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
yiisoft/arrays Version ^3.0
yiisoft/event-dispatcher Version ^1.0
yiisoft/html Version ^3.0
yiisoft/json Version ^1.0
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package beastbytes/schema-dot-org-helper contains the following files

Loading the files please wait ....