tc-lib-file

Technical overview and integration notes for tc-lib-file

Overview

tc-lib-file provides low-level file access and byte-reading primitives used by higher-level PDF and document libraries.

The package is intentionally small but critical: it centralizes stream safety and binary handling so dependent components can focus on document semantics instead of reimplementing I/O details.

Repository and API Docs

Project Metadata

ItemValue
Namespace\Com\Tecnick\File
LicenseGNU LGPL v3

Installation

composer require tecnickcom/tc-lib-file

Where It Fits

Adopt this package when inputs may come from filesystem paths, inline data URIs, or mixed source abstractions.

Features

File Access

  • Local and URL-backed file reading helpers
  • Path-safety checks for local operations
  • cURL-based retrieval options for remote resources

Binary Utilities

  • Byte, integer, and structured binary reads
  • Helpers used by parser and image/font import stacks
  • Error handling through typed exceptions

Requirements

  • PHP 8.2 or later
  • Extensions: curl, pcre
  • Composer

Development and Packaging

  • QA and local checks: make deps, make help, make qa
  • Packaging: make rpm, make deb

Support and Contribution

Integration Notes

  • Whitelist accepted schemes and paths before loading untrusted references.
  • Centralize asset resolution in one adapter to simplify auditing and testing.
  • Validate MIME assumptions before embedding assets.

Example

<?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);
 

© 2004-2026 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy