PHPackages                             alwaysblank/schemer - 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. alwaysblank/schemer

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

alwaysblank/schemer
===================

Help with schema.org generation.

0.13.0(6y ago)7676[1 PRs](https://github.com/alwaysblank/schemer/pulls)MITPHPPHP ^7.2CI failing

Since Jul 31Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/alwaysblank/schemer)[ Packagist](https://packagist.org/packages/alwaysblank/schemer)[ RSS](/packages/alwaysblank-schemer/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (3)Dependencies (2)Versions (11)Used By (0)

Schemer 🦹
=========

[](#schemer-)

Help with [schema.org](https://schema.org/) markup generation.

[![Build Status](https://camo.githubusercontent.com/5c2b969560b1e8cffd02907281290130da7fbd2d4d3431609ca4b1930fea486d/68747470733a2f2f7472617669732d63692e6f72672f616c77617973626c616e6b2f736368656d65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/alwaysblank/schemer)

Usage
-----

[](#usage)

> **Note:** Currently, Schemer generates only the "microdata" format.

Schemer is designed to be pretty simple to use: Just pass a structured array to the `::build()` static method on the Scheme you want:

```
echo AlwaysBlank\Schemer\Scheme\PostalAddress::build([
    ['street', '123 Oak St'],
    ['state', 'OR'],
    ['city', 'Portland'],
    ['zip', '97123'],
    ['pobox', 'P.O. 1234'],
    ['country', 'USA'],
]);

// 123 Oak StORPortland97123P.O. 1234USA
```

You can optionally pass a second argument, which is a array of arguments that will override the defaults. This allows you to do things like change the wrapping element tag, add arbitrary attributes, etc.

```
echo AlwaysBlank\Schemer\Scheme\PostalAddress::build([
    ['street', '123 Oak St'],
    ['state', 'OR'],
    ['city', 'Portland'],
    ['zip', '97123'],
    ['pobox', 'P.O. 1234'],
    ['country', 'USA'],
], [
    'tag' => 'a',
    'attributes' => [
        'href'      => 'https://www.alwaysblank.org',
        'hidden'    => true,
    ],
]);
//
