PHP code example of ticaje / solid-file-manager

1. Go to this page and download the library: Download ticaje/solid-file-manager 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/ */

    

ticaje / solid-file-manager example snippets




declare(strict_types=1);

use Ticaje\FileManager\Implementors\Reader\File\BoxSpout\Xlsx as Implementor;
use Ticaje\FileManager\Infrastructure\Driver\Iterator\SimpleIterator;
use Ticaje\FileManager\Infrastructure\Driver\Reader\File\Xlsx as FileAgent;

$fileName = '/path/to/file.xlsx'; // Too simple to explain
$implementor = new Implementor();
$fileManager = new FileAgent($implementor, true); // gonna say it has header
$fileManager->setSource($fileName);
$simpleIterator = new SimpleIterator($fileManager);

// Get first five rows
$firstFiveRows = $simpleIterator->getChunk(0, 5);
print_r($firstFiveRows); // printing content out

// Get rest of content
$content = $fileManager->getContent();
while ($content->valid()) {
    $item = $content->current();
    print_r($implementor->asArray($item)); // printing content out
    $content->next();
}

// Printing out header
$header = $fileManager->getHeader();
print_r($implementor->asArray($header));