2017 © Pedro Peláez
 

library calendar-summary-v3

Library to convert cultuurnet dates to a readable summary

image

cultuurnet/calendar-summary-v3

Library to convert cultuurnet dates to a readable summary

  • Friday, January 12, 2018
  • by svenhoutmeyers
  • Repository
  • 12 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

calendar-summary-v3

Build Status Coverage Status, (*1)

Installation

You can install the cultuurnet\calendar-summary-v3 PHP library in different ways:, (*2)

  • Standalone. Clone or download from github and use Composer. Run composer install from the root of the clone to download the necessary dependencies. Standalone usage is probably only useful for testing purposes.
  • Inside your project: require the cultuurnet/calendar-summary-v3 package (it is registered on Packagist) and the cultuurnet/cdb package in your project's composer.json file and run composer update.
{
    "require": {
        "cultuurnet/calendar-summary-v3": "dev-master"
    }
}

How it works

The calendar-summary-v3 PHP takes the start and end date of an Event or Place object (hence the dependency oncultuurnet/search-v3), and formats it. There's a HTML formatter and a plain text formatter., (*3)

Types

The Event or Place object has a calendarType property which can have one of the four following options: * single * multiple * periodic * permanent, (*4)

Parameters

There are 3 (optional) parameters which can be used on the initialisation of the formatters. Those are * langCode * hidePastDates * timeZone, (*5)

langCode

(string) Default value: 'nl_BE'. You can use this parameter to change the language of the output that the formatter will produce. Currently works in nl, fr, de and en. The format here is standard PHP locales. For example 'fr_BE' or 'de_BE'., (*6)

hidePastDates

(boolean) Default value: false. This parameter (when true) will only be used on offers with a calendarType 'multiple'. When true dates in the past won't be in the formatter's output., (*7)

timeZone

(string) Default value: 'Europe/Brussels' You can set a different timezone with this parameter. Supported timezones can be found in thislist., (*8)

Formats

After initializing the formatter, you call the format method with the following 2 parameters: * Event or Place object (from cultuurnet/search-v3) * The desired output format ('xs', 'sm', 'md' or 'lg'), (*9)

Using an unsupported format will throw an exception., (*10)

Example

<?php
    $event = new Event();

    // This will format the calendar info of $event in an medium HTML output 
    $calendarHTML = new CalendarHTMLFormatter('nl_BE', true, 'Europe/Brussels');
    $calendarHTML->format($event, 'md');

    // This will format the calendar info of $event in a large plain text output
    $calendarPlainText = new CalendarPlainTextFormatter('fr_BE', true, 'Europe/Paris');
    $calendarPlainText->format($event, 'lg');

The Versions

12/01 2018

dev-feature/mkok-branch

dev-feature/mkok-branch

Library to convert cultuurnet dates to a readable summary

  Sources   Download

Apache-2.0

The Requires

  • php ^7.0
  • ext-intl *

 

The Development Requires

by Nils Destoop
by Thomas Jacobs

11/01 2018

dev-master

9999999-dev

Library to convert cultuurnet dates to a readable summary

  Sources   Download

Apache-2.0

The Requires

  • php ^7.0
  • ext-intl *

 

The Development Requires

by Nils Destoop
by Thomas Jacobs

11/01 2018

dev-feature/WKS-343-Periodic

dev-feature/WKS-343-Periodic

Library to convert cultuurnet dates to a readable summary

  Sources   Download

Apache-2.0

The Requires

  • php ^7.0
  • ext-intl *

 

The Development Requires

by Nils Destoop
by Thomas Jacobs

11/01 2018

dev-feature/WKS-343-Permanent

dev-feature/WKS-343-Permanent

Library to convert cultuurnet dates to a readable summary

  Sources   Download

Apache-2.0

The Requires

  • php ^7.0
  • ext-intl *

 

The Development Requires

by Nils Destoop
by Thomas Jacobs

11/01 2018

dev-feature/single-formatter

dev-feature/single-formatter

Library to convert cultuurnet dates to a readable summary

  Sources   Download

Apache-2.0

The Requires

  • php ^7.0
  • ext-intl *

 

The Development Requires

by Nils Destoop
by Thomas Jacobs

21/11 2017

dev-feature/multiple-formatter

dev-feature/multiple-formatter

Library to convert cultuurnet dates to a readable summary

  Sources   Download

Apache-2.0

The Requires

  • php ^7.0
  • ext-intl *

 

The Development Requires

by Nils Destoop
by Thomas Jacobs