danjones000/php-xattr
Composer 安装命令:
composer require danjones000/php-xattr
包简介
Simple module for accessing and modify file extended attributes
README 文档
README
This library is intended for accessing and manipulating a file's extended attributes.
This probably only works on Linux, and everything has to be set up just right for this to work.
Ideally, you should have the xattr extension installed.
If you don't have it installed, we'll try to use the attr
command.
This library is designed to fail silently. This means that if neither the xattr extension, or the attr command are available, it will simply do nothing. This will also happen if the filesystem doesn't support extended attributes.
Installation
composer require danjones000/php-xattr
Usage
use Danjones\Xattr\Xattr;
use Danjones\Xattr\File;
$file = 'path/to/file';
$xattr = new Xattr();
$attributes = $xattr->list($file); // Returns array of attribute names, without values
$value = $xattr->get($file, $name); // Returns a string, or null if not available
$xattr->set($file, $name, 'new-value'); // This will return nothing.
$file2 = 'path/to/another/file';
$xattr->copy($file, $name, $file2); // Copies the attribute named $name from $file to $file2
$xattr->clone($file, $file2); // Copies all attributes from $file to $file2. Existing attributes in $file2 will remain intact
// Use File object when doing multiple operations on a single file
// All methods from $xattr are available. void methods from Xattr return the object, so they can be chained.
$fileObj = $xattr->file($file); // or new File($file);
$file2Obj = $xattr->file($file2);
$fileObj->set($name, 'another-value')->copy($name, $file2Obj);
$fileObj->clone($file2); // Can use either path, or another File object
$file2Obj->list(); // Will have all the attributes added by $fileObj
danjones000/php-xattr 适用场景与选型建议
danjones000/php-xattr 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 03 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 danjones000/php-xattr 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 danjones000/php-xattr 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-10