PHPackages                             palex/phpstructureddata - 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. palex/phpstructureddata

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

palex/phpstructureddata
=======================

A set of PHP libraries that use the http://schema.org vocabulary to implement and output Microdata or RDFa Lite 1.1 semantics.

v2.0.1(11y ago)3513.4k4[2 issues](https://github.com/alexprut/PHPStructuredData/issues)MITPHPPHP &gt;=5.3.0

Since Sep 21Pushed 6y ago6 watchersCompare

[ Source](https://github.com/alexprut/PHPStructuredData)[ Packagist](https://packagist.org/packages/palex/phpstructureddata)[ Docs](https://github.com/PAlexcom/PHPStructuredData)[ RSS](/packages/palex-phpstructureddata/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

PHPStructuredData [![Build Status](https://camo.githubusercontent.com/feaa21c3c48173f7f4a9db83746ba9311838ff61979d8553e2add3c2ce690aa3/68747470733a2f2f7472617669732d63692e6f72672f616c6578707275742f50485053747275637475726564446174612e737667)](https://travis-ci.org/alexprut/PHPStructuredData)
===================================================================================================================================================================================================================================================================================================

[](#phpstructureddata-)

A set of PHP libraries that use the  vocabulary to implement and output Microdata or RDFa Lite 1.1 semantics.
This library is used in the Joomla CMS since version 3.2 (called [JMicrodata](https://github.com/joomla/joomla-cms/tree/master/libraries/joomla/microdata "JMicrodata")).
Created during the Google Summer of Code 2013 and 2014.

Quick overview
--------------

[](#quick-overview)

The library was designed with this goals in mind:

1. Having the possibility to **switch between Microdata** and **RDFa Lite 1.1** semantics.
2. Having the possibility to **switch the Type dynamically**, you just change the Type (there are more than 550+ different available Types).
3. Display **validated semantics**, the library takes care of displaying data in the correct format (e.g. all the dates in the ISO standard).
4. **Enable/disable** the **library** output.
5. **Fallbacks**, you should never lose any meaningful semantic (e.g. if you change the Type and it does not have an *author* Property, it will fallback to the *Person* Type with the *name* Property).

Class diagram
-------------

[](#class-diagram)

[![Class Diagram](https://camo.githubusercontent.com/49b49c34af313c8ed31c20b0e25649f1410a9b49f5c32fbb28f16ac8a497e08c/68747470733a2f2f616c6578707275742e6769746875622e696f2f50485053747275637475726564446174612f696d616765732f636c6173736469616772616d2d76322e302e302e706e67)](https://camo.githubusercontent.com/49b49c34af313c8ed31c20b0e25649f1410a9b49f5c32fbb28f16ac8a497e08c/68747470733a2f2f616c6578707275742e6769746875622e696f2f50485053747275637475726564446174612f696d616765732f636c6173736469616772616d2d76322e302e302e706e67)

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

[](#installation)

- **Composer**:
    Add in your `composer.json` file:

    ```
    {
        "require": {
            "palex/phpstructureddata": "*"
        }
    }
    ```
- **From Source**:
    Run `git clone https://github.com/alexprut/PHPStructuredData.git`
- **Direct download**:
    Download the last version from [here](https://github.com/alexprut/PHPStructuredData/archive/master.zip "download")

Usage Example
-------------

[](#usage-example)

Let's suppose that you already have an instance of the Microdata or RDFa library. And you need to add Microdata or RDFa semantics to the following HTML which is part of an article (*e.g.* `$sd = new PHPStructuredData\Microdata('Article');`).

```
>
