PHP code example of amattu2 / event-logger

1. Go to this page and download the library: Download amattu2/event-logger 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/ */

    

amattu2 / event-logger example snippets


/**
 * Add a new event to the log
 *
 * @param string $text event content
 * @param ?DateTime $timestamp event timestamp
 * @return boolean success
 * @author Alec M.
 */
public function addEvent(string $text, \DateTime $timestamp = null) : bool

/**
 * Return first event timestamp
 *
 * @return \DateTime
 */
public function getStartTime() : \DateTime

/**
 * Return last event timestamp
 *
 * @return \DateTime
 */
public function getEndTime() : \DateTime

/**
 * Return collection of events
 *
 * @return array
 */
public function getEvents() : array

/**
  * Return the event list as a HTML table
  *
  * @param string $date_format DateTime format string
  * @return string HTML table
  */
public function getEventsTable(string $date_format = "Y-m-d G:i:s") : string