10quality/wp-file
Composer 安装命令:
composer require 10quality/wp-file
包简介
Small class library that facilitates file handling in WordPress.
关键字:
README 文档
README
This small class library facilitates file handling for WordPress custom developments, will provide all functionality to meet WordPress' standards.
Features:
- Theme Check ready.
- Easy to use.
Installation
With composer
Make the dependecy required in your project:
composer require 10quality/wp-file
Alternative
Download or clone the project and load the class with php functions:
require_once '[PATH TO CLASS]/File.php';
Usage
The following example will let you see how to use the class:
Code to replace
$filename = __DIR__.'/myfile.txt'; $file = @fopen( $filename, ,'w+' ); $content = fread( $file ); fwrite( $file, $content ); fclose($file);
Replacement:
use TenQuality\WP\File; $filename = __DIR__.'/myfile.txt'; $content = File::auth()->read( $filename ); File::auth()->write( $filename, $content );
Authentication
WordPress will require to authenticate a url in order to validate if filesystem credentials are in place.
If you need to authenticate a specific url, pass it like this:
File::auth( $url )->read( $filename );
Other methods
// Returns bool $isFile = File::auth()->is_file( $filename ); // Returns bool $fileExists = File::auth()->exists( $filename );
Folder or Path handling
Methods to handle files:
$file = File::auth(); // Use is_dir to check if a path exists or not. if ( $file->is_dir( $path ) ) // Use mkdir to create non-existent paths. $file->mkdir( $path ); // Use rmdir to remove paths. $file->rmdir( $path );
Recomendations
Store your files in the uploads folder.
Coding guidelines
PSR-4.
LICENSE
The MIT License (MIT)
Copyright (c) 2016 10Quality.
10quality/wp-file 适用场景与选型建议
10quality/wp-file 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.8k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 09 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「file」 「filesystem」 「wordpress」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 10quality/wp-file 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 10quality/wp-file 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 10quality/wp-file 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A SDK for working with B2 cloud storage.
A PHP class providing static methods for reading, writing, copying, moving, and deleting files and directories, MIME type detection, image size detection, and file permission management
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
The flysystem adapter for yandex disk rest api.
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
Laravel Media Popup to upload/view the files
统计信息
- 总下载量: 6.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 9
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-09-21