PHP code example of jdz / dump

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

    

jdz / dump example snippets


use JDZ\Utils\Dump;

$dump = new Dump('/path/to/logfile.txt');

// Write content (appends to file)
$dump->write('First line');
$dump->write('Second line');

// Read file contents
$content = $dump->read(); // "First line\nSecond line\n"

// Check if file exists
$dump->exists(); // true

// Delete file
$dump->delete();
$dump->exists(); // false

$dump = new Dump('/tmp/debug.log');
$dump->write('Starting process')
     ->write('Step 1 complete')
     ->write('Step 2 complete');

$dump = new Dump('/path/to/missing.txt');
$dump->read(); // null