PHP code example of liturgical-calendar / components

1. Go to this page and download the library: Download liturgical-calendar/components library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

liturgical-calendar / components example snippets



iturgicalCalendar\Components\CalendarSelect;

$options = ['locale' => 'it']; // set the locale to Italian
$CalendarSelect = new CalendarSelect($options); // use the default API url, but set the locale to Italian

echo $CalendarSelect->getSelect([
                        'class'    => 'form-select',
                        'id'       => 'calendarSelect',
                        'options'  => 'all',
                        'label'    => true,
                        'labelStr' => _("Select calendar")
                    ]);


iturgicalCalendar\Components\ApiOptions;
$apiOptions = new ApiOptions();
echo $apiOptions->getForm();


iturgicalCalendar\Components\ApiOptions;
use LiturgicalCalendar\Components\ApiOptions\PathType;
$apiOptions = new ApiOptions();
echo $apiOptions->getForm(PathType::BASE_PATH);
echo '<br>';
echo $apiOptions->getForm(PathType::ALL_PATHS);


iturgicalCalendar\Components\ApiOptions;
use LiturgicalCalendar\Components\ApiOptions\PathType;
$options = [
    'locale'    => 'it-IT'
];
$apiOptions = new ApiOptions($options);
echo $apiOptions->getForm(PathType::BASE_PATH);
echo '<br>';
echo $apiOptions->getForm(PathType::ALL_PATHS);


iturgicalCalendar\Components\ApiOptions;
$options = [
    'locale'    => 'it-IT',
    'wrapper'   => 'div', //we can set a string representing the 'as' html element
    'formLabel' => 'h5'   //we can set a string representing the 'as' html element
];
$apiOptions = new ApiOptions($options);
$apiOptions->wrapper->class('calendarOptions')->id('calendarOptions');
$apiOptions->formLabel->text('Liturgical Calendar API Request Options');
echo $apiOptions->getForm();


iturgicalCalendar\Components\ApiOptions;
use LiturgicalCalendar\Components\ApiOptions\Input;
$options = [
    "locale"    => "it-IT",
    "wrapper"   => true, //we can simply set a boolean, then set the 'as' html element afterwards by using the ->as() method
    "formLabel" => true  //we can simply set a boolean, then set the 'as' html element aftereards by using the ->as() method
];
$apiOptions = new ApiOptions($options);
$apiOptions->wrapper->as('div')->class('calendarOptions')->id('calendarOptions'); //we could also have set 'as', 'class' and 'id' directly in the $options
                                                                                  // array by passing an array [ 'as' => 'div', 'class' => 'calendarOptions',
                                                                                  // 'id' => 'calendarOptions' ] to the 'wrapper'
$apiOptions->formLabel->as('h5')->text('Liturgical Calendar API Request Options');//we could also have set 'as' and 'text' directly in the $options
                                                                                  // array by passing an array [ 'as' => 'h5', 'text' => '...' ]
                                                                                  // to 'formLabel'
Input::setGlobalWrapper('div');
Input::setGlobalWrapperClass('form-group');
Input::setGlobalInputClass('form-select');
echo $apiOptions->getForm();


iturgicalCalendar\Components\ApiOptions;
use LiturgicalCalendar\Components\ApiOptions\Input;
$options = [
    "locale"    => "it-IT",
    "wrapper"   => true,
    "formLabel" => true
];
$apiOptions = new ApiOptions($options);
$apiOptions->wrapper->as('div')->class('calendarOptions')->id('calendarOptions');
$apiOptions->formLabel->as('h5')->text('Liturgical Calendar API Request Options');
$apiOptions->epiphanyInput->class('epiphany-input')->id('epiphanyInput')->labelClass('epiphany-label')->wrapper('div')->wrapperClass('epiphany-wrapper');
echo $apiOptions->getForm();

composer  install