Download the PHP package alwaysblank/schemer without Composer

On this page you can find all versions of the php package alwaysblank/schemer. 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 schemer

Schemer 🦹

Help with schema.org markup generation.

Build Status

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:

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.

The actual HTML output is slightly different: To allow for simple breaks but maximum styling options, each inline element is followed by <span class="spc">&#8203;</span>, a zero-width space. This allows the browser to break at this point, but contributes no formatting apart from that.

Schemes

Currently Schemer supports the following Schemes in some fashion. More will be added in the future! Please feel free to file an issue with schemes you'd like to see, or—even better!—a pull request adding them. See "How It Works" below for more information on how to create new Schemes and Properties.

How It Works

There are three basic parts to Schemer:

Node

The Node is the simplest element, and also the only element that actually behaves like a class (Propertys and Schemes, though classes, are really just wrappers for static methods). It provides a sort of wrapper for individual segments of a Propery or Scheme, and is what is used to generate the actual HTML.

In general, you probably won't be interacting with Nodes very much outside of creating them by passing a set of arguments:

Understanding this syntax is helpful, because it will be necessary for creating new Propertys, or to modify existing properties or Schemes.

Property

A Property's one purpose in life is to return a Node with the appropriate arguments for the the schema.org property it represents. It is also implemented as a Trait so that it can be composed into a Scheme later on.

A Property must meet the following requirements:

A Property can take input of any kind (although most take strings), but you should be aware that there isn't a obvious mechanism (apart from reading the source code) to know what specific format a Property might be expecting its argument to be in, so keep user experience in mind when building these things.

Scheme

A Scheme is the top dog; the final thing Schemer exists to do. They are surprisingly simple. A Scheme has to do the following:

Here's an example Scheme:

Aliases

When defining Nodes, you can use abbreviations for the properties. This may be useful if you find yourself in a situation where you need to type up a lot of Nodes.

Supported abbreviations are:

Property Alias(es)
itemscope scope, iscope
itemprop prop, iprop
itemtype type, itype
attributes attr, attrs

This will create a Scheme called Example that will understand city and name, and will use a <section> with an additional attribute of data-section="example".

Going Further

If you have more questions about how these things work, I encourage you to dig into the source code. I've made an effort to document the code clearly inline, and keep everything simple and clear.

Debugging

To debug Schemer, set the PHP constant ALWAYSBLANK_SCHEMER_DEBUG to true. As with any debug flag, I don't recommend you set this in production.

Currently the debug flag has the following effects (this list may expand with time):

Limitations

Nesting

The output of a Scheme is generally pretty "flat" in the sense that it's just a list of elements that aren't nested within on another. (The exception being if the Scheme in question includes other Schemes as Propertys, as LocalBusiness does with Address.) This is more or less by design: So far as I can tell, building a system that would allow a user to dynamically modify the nesting of arbitrary elements would create an extreme amount of complexity in a library that is supposed to be very simple. In general, Scheme-level content isn't usually heavily nested anyway (apart from the aforementioned exceptions).

If you find yourself needing a more complex structure, Schemer is design to be flexible enough that you can build Schemes and Propertys "on the fly"—or even just use Propertys directly without the need for a Scheme.

Options

This library is currently limited in terms of what it "understands". While it can be easily expanded, I have no intention of ever making it comprehensive with respect to the full schema.org specifications. Polite feature requests are always welcome (and good PRs will likely be merged without question), but please keep in mind that the primary purpose of this library is to make a small slice of repetitive tasks less repetitive, not to solve all microdata-related problems.


All versions of schemer with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
alwaysblank/brief Version ^2.0.0-alpha
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 alwaysblank/schemer contains the following files

Loading the files please wait ....