PHP utilities for low-level file access and byte-level reading.
If this project is useful to you, please consider supporting development via GitHub Sponsors.
tc-lib-file provides safe primitives for opening files, reading bytes, and handling binary-oriented workflows used by higher-level PDF and document libraries.
The package is intentionally small but critical: it centralizes low-level I/O concerns so higher-level libraries can focus on document semantics instead of stream safety and byte handling. This separation improves reliability, testability, and reuse across the broader Tecnick ecosystem.
| Namespace | \Com\Tecnick\File |
| Author | Nicola Asuni info@tecnick.com |
| License | GNU LGPL v3 - see LICENSE |
| API docs | https://tcpdf.org/docs/srcdoc/tc-lib-file |
| Packagist | https://packagist.org/packages/tecnickcom/tc-lib-file |
- Local and URL-backed file reading helpers
- Path-safety checks for local operations
- cURL-based retrieval options for remote resources
- Byte, integer, and structured binary reads
- Helpers used by parser and image/font import stacks
- Error handling via typed exceptions
- PHP 8.2 or later
- Extensions:
curl,pcre - Composer
composer require tecnickcom/tc-lib-file<?php
require_once __DIR__ . '/vendor/autoload.php';
$file = new \Com\Tecnick\File\File();
$fh = $file->fopenLocal(__FILE__, 'rb');
$header = $file->fReadInt($fh);
var_dump($header);make deps
make help
make qamake rpm
make debFor system packages, bootstrap with:
require_once '/usr/share/php/Com/Tecnick/File/autoload.php';Contributions are welcome. Please review CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md.