承接 webfiori/file 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

webfiori/file

最新稳定版本:2.0.4

Composer 安装命令:

composer require webfiori/file

包简介

Basic class library to read, write and view files using PHP.

README 文档

README

A PHP library for file operations, providing an object-oriented abstraction layer for reading, writing, uploading, and serving files with Base64 encoding/decoding, MIME type detection, and chunked file processing.

Installation

composer require webfiori/file

Requirements

  • PHP 8.1 or higher
  • webfiori/jsonx ^4.0

Supported PHP Versions

Build Status

Quick Start

<?php
require_once 'vendor/autoload.php';

use WebFiori\File\File;

$file = new File('/path/to/document.txt');
$file->read();
echo $file->getRawData();

Core Classes

  • File — Read, write, create, remove, and serve files. Supports byte-range reads, Base64 encoding/decoding, chunked processing, and JSON serialization.
  • FileUploader — Handle file uploads with extension validation, size limits, and detailed error reporting.
  • UploadedFile — Extends File with upload-specific properties (upload status, replacement status, error message).
  • MIME — Static lookup of ~600 file extension to MIME type mappings.

Examples

The examples/ directory contains runnable PHP scripts covering every feature of the library:

Example Description
Reading and Writing Files Create, write, read, append, and remove files
File Information File metadata: name, extension, MIME, size, timestamps, constructor variants
Partial Read Read specific byte ranges from a file
Appending Data Build up in-memory content with append()
Base64 Encoding Encode/decode Base64, writeEncoded(), readDecoded()
Chunked Processing Split file data into fixed-size chunks
Bytes and Hex Convert data to byte arrays and hex strings
MIME Detection Look up MIME types by extension
Error Handling FileException scenarios and how to handle them
JSON Serialization Convert File objects to JSON
Path Utilities Path normalization, directory creation, file existence checks
File Upload Configure and process uploads with FileUploader
Serving Files Serve files over HTTP with proper headers

Each example has its own README with detailed explanations. Run any example with:

php examples/read-and-write/read-and-write.php

Testing

# Run all tests
composer test

# Run tests with PHPUnit 10
composer test10

Contributing

  1. Fork the repository and create a feature branch
  2. Write tests for new functionality
  3. Follow PSR-12 coding standards
  4. Submit a pull request

License

MIT — see LICENSE for details.

统计信息

  • 总下载量: 28.46k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-05-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固