<commit_before># PHP console.log()

PHP console.log() allows you to dump PHP variables in the browser's console. It is an easy-to-use and lightweight PHP library.

## Installation

Currently, it is not possible to require this library with composer.

Just download/clone this repository and `require` the front PHP-file :

```
require_once(__DIR__ . '/php-console-log.php');
```

## Usage

More detailed working examples can be found in the `./examples/` directory.

### Basic PHP console.log()

Define a place where the library should output the console logs:

```
<?php execConsoleLogs(); ?>
```

You can now use the `consoleLog()` function everywhere, as long as it is called before an `execConsoleLogs()` call.

```
<?php 

$myArray = ['one','two','three'];

consoleLog($myArray);

?>
```

You can use `consoleLog()` with any type of variable. If you want to output an PHP array or object, the library will show a JavaScript Array or Object in the browser's console. A boolean will remain a boolean, an integer will remain an integer, a string remain a string, and so on.

### Edit the `<script>` tag

All this library does is generating a `<script>` where you asked it (using `the execConsoleLogs()` function).

This tag contains the required JavaScript logic in order to output the requested data in the browser's console. There is not much you could do on the generated JavaScript code, but you can add an attribute on the `<script>` tag.

By default, the library generates the following HTML markup:

```
<script type="text/javascript" data-php-console-log="true">
      [...]
</script>
```
You can remove or modify the `data-php-console-log` attribute by setting it as follows:

```
/*
 * Remove the attribute :
 */

$PHPConsoleLog->setAttribute();
      // or
$PHPConsoleLog->setAttribute(false);


/*
 * Edit the attribute :
 */

      // simple attribute
$PHPConsoleLog->setAttribute('data-my-attribute');
      // attribute with value
$PHPConsoleLog->setAttribute('data-my-attribute', 'attribute-value');
```

## What now ?

Well, I wrote this library in a hurry, so there's probably a lot to change/to add. Feel free to contribute or to request some changes.<commit_msg>Fixed a few minor things to readme<commit_after># PHP console.log()

PHP console.log() allows you to dump PHP variables in the browser's console. It is an easy-to-use and lightweight PHP library.

## Installation

Currently, it is not possible to require this library with composer.

Just download/clone this repository and `require` the front PHP-file :

```php
require_once(__DIR__ . '/php-console-log.php');
```

## Usage

More detailed working examples can be found in the `./examples/` directory.

### Basic PHP console.log()

Define a place where the library should output the console logs:

```php
<?php execConsoleLogs(); ?>
```

You can now use the `consoleLog()` function everywhere, as long as it is called before an `execConsoleLogs()` call.

```php
<?php 

$myArray = ['one','two','three'];

consoleLog($myArray);

?>
```

You can use `consoleLog()` with any type of variable. If you want to output an PHP array or object, the library will show a JavaScript Array or Object in the browser's console. A boolean will remain a boolean, an integer will remain an integer, a string remain a string, and so on.

### Edit the `<script>` tag

All this library does is generating a `<script>` where you asked it (using `the execConsoleLogs()` function).

This tag contains the required JavaScript logic in order to output the requested data in the browser's console. There is not much you could do on the generated JavaScript code, but you can add an attribute on the `<script>` tag.

By default, the library generates the following HTML markup:

```html
<script type="text/javascript" data-php-console-log="true">
      [...]
</script>
```
You can remove or modify the `data-php-console-log` attribute by setting it as follows:

```php
/*
 * Remove the attribute :
 */

$PHPConsoleLog->setAttribute();
      // or
$PHPConsoleLog->setAttribute(false);


/*
 * Edit the attribute :
 */

      // simple attribute
$PHPConsoleLog->setAttribute('data-my-attribute');
      // attribute with value
$PHPConsoleLog->setAttribute('data-my-attribute', 'attribute-value');
```

## What now ?

Well, I wrote this library in a hurry, so there's probably a lot to change/add. Feel free to contribute or to request some changes.
{'fraction_non_alphanumeric': 0.11176737846433439, 'fraction_numerical': 0.0, 'mean_word_length': 4.131701631701632, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3763793', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1178, 'n_words': 565}