jeroendn/php-js-console-logger

A simple way to create javascript console logs via a php function.

v1.0.2 2022-09-08 13:55 UTC

This package is auto-updated.

Last update: 2024-12-11 17:24:38 UTC


README

A simple way to create JavaScript console logs via a PHP class.

This package has mostly been made as a joke and to get some experience setting up a package. Feel free to find any good use for it.

Alt Text

Installation

composer require jeroendn/php-js-console-logger

How to use

use jeroendn\PhpJsConsoleLogger\PhpJsConsoleLogger;

$logger = new PhpJsConsoleLogger();

/**
 * Setting required parameters
 */
$logger->setLog('Example');
// OR
$logger->setLogs(['Example1', 'Example2', 'Example3']);

/**
 * Setting optional parameters
 */
$logger
  ->setTimeout(5000)
  ->setInterval(500)
  ->setIterations(5)
  ->setIterationSpacer('-')

echo $logger->getHtml(); // Returns the generated JavaScript inside an HTML tag
// OR
echo $logger->getJs(): // Returns the generated JavaScript

Development

Run tests

./vendor/bin/phpunit