sentgine/file 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

sentgine/file

Composer 安装命令:

composer require sentgine/file

包简介

A simple wrapper around file system operations.

README 文档

README

License Latest Stable Version Total Downloads

File is a PHP library that provides a simple wrapper around file system operations.

Features

  • Create, read, update, and delete files.
  • Create directories if they do not exist.
  • Replace placeholders in a source file and write the modified content to a destination file.
  • Remove directories and all their contents recursively.

Requirements

  • PHP 8.0 or higher.

Installation

You can install the package via Composer by running the following command:

composer require sentgine/file:^1.0

Sample Usage of Filesystem

Basic Usage

use Sentgine\File\Filesystem;

// Create a new instance of the Filesystem class
$fileSystem = new Filesystem();

// Set source and destination files
$fileSystem->setSourceFile('path/to/source/file.txt')
           ->setDestinationFile('path/to/destination/file.txt');

// Read content from the source file
$content = $fileSystem->read();

// Update content in the destination file
$fileSystem->update('New content');

// Delete the destination file
$fileSystem->delete();

Usage of replaceContent

use Sentgine\File\Filesystem;

// Create a new instance of the Filesystem class
$fileSystem = new Filesystem();

 // Get the content of the file.text file
$content = $filesystem->setSourceFile('/source/directory/file.text')->read();

// Create a new directory if it doesn't exist
$filesystem->createDirectory('/source/new_directory');

// Write the content to the Controller file
$filesystem->setDestinationFile('/source/new_directory/new_file.text')->create($content);

// Replace the content of the destination file
$filesystem->replaceContent(
    replacements: [
       'placeholder1' => 'replacement1',
        'placeholder2' => 'replacement2',
    ]
);

The destination file (path/to/source/file.txt) should contain placeholders formatted as {{ placeholder }}, as shown in the example below:

Hello {{ placeholder1 }},

This is a sample file with placeholders. Here is the value of placeholder2: {{ placeholder2 }}.

Thank you!

Changelog

Please see the CHANGELOG file for details on what has changed.

Security

If you discover any security-related issues, please email sentgine@gmail.com instead of using the issue tracker.

Credits

File is built and maintained by Adrian Navaja.

  • Check out some cool tutorials and stuff on YouTube!
  • Catch my latest tweets and updates on Twitter (formerly X)!
  • Let's connect on a more professional note over on LinkedIn!
  • For more information about me and my work, visit my website: sentgine.com.

License

The MIT License (MIT). Please see the LICENSE file for more information.

sentgine/file 适用场景与选型建议

sentgine/file 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 30 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 sentgine/file 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sentgine/file 我们能提供哪些服务?
定制开发 / 二次开发

基于 sentgine/file 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 30
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-12