Skip to content
This repository has been archived by the owner on Dec 18, 2022. It is now read-only.

barnebys/markup-protocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Stable Version Build Status Coverage Status

Barnebys Markup Protocol

This library is a tool to generate Barnebys Markup Tags with PHP.

Requirements

PHP >= 5.6

Installation

The recommended way is to use composer

composer require barnebys/markup-protocol

If your project does not support composer, you can either clone the project on GitHub or download the package from here. You will then have to manually add the library to your project.

Examples

Auction Item

Code

use Barnebys\Protocol\Object;
use Barnebys\Protocol\Auction;
use Barnebys\Protocol\Price;

// Creates a new object
$object = new Object();
$object ->setTitle('Rolex 1956')
        ->setDescription('A fine watch in mint condition.')
        ->setURL('http://test.com/lot/1234')
        ->setImage('http://test.com/lot/1234.jpg')
        ->setCategory('watches')
        ->setPrice(new Price(150, 200, 'EUR'))
        ->setAuction(new Auction('2017-04-22T15:03:01.012345Z', '2017-08-01T15:03:01.012345Z'));

// Prints the meta tags
echo $object;

Outputs

<meta property="barnebys:title" content="Rolex 1956">
<meta property="barnebys:description" content="A fine watch in mint condition.">
<meta property="barnebys:url" content="http://test.com/lot/1234">
<meta property="barnebys:image" content="http://test.com/lot/1234.jpg">
<meta property="barnebys:category" content="watches">
<meta property="barnebys:price:amount" content="150">
<meta property="barnebys:price:bid" content="200">
<meta property="barnebys:price:currency" content="EUR">
<meta property="barnebys:auction:start" content="2017-04-22T15:03:01+00:00">
<meta property="barnebys:auction:end" content="2017-08-01T15:03:01+00:00">

Fixed Price Item

Code

// Creates a new object
$object = new Object();
$object ->setTitle('Rolex 1956')
        ->setDescription('A fine watch in mint condition.')
        ->setURL('http://test.com/lot/1234')
        ->setImage('http://test.com/lot/1234.jpg')
        ->setCategory('watches')
        ->setSold(false)
        ->setPrice(new Price(150, null, 'EUR'));

// Prints the meta tags
echo $object;

Outputs

<meta property="barnebys:title" content="Rolex 1956">
<meta property="barnebys:description" content="A fine watch in mint condition.">
<meta property="barnebys:url" content="http://test.com/lot/1234">
<meta property="barnebys:image" content="http://test.com/lot/1234.jpg">
<meta property="barnebys:category" content="watches">
<meta property="barnebys:price:amount" content="150">
<meta property="barnebys:price:currency" content="EUR">
<meta property="barnebys:sold" content="0">

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages