PHPackages                             icarexm/file - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. icarexm/file

ActiveLibrary[File &amp; Storage](/categories/file-storage)

icarexm/file
============

the new file extend

10PHP

Since May 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/icarexm/php-tools-file)[ Packagist](https://packagist.org/packages/icarexm/file)[ RSS](/packages/icarexm-file/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

使用`Composer`安装`icarexm`的文件处理类库：

```
composer require icarexm/file:dev-master

```

上传文件
----

[](#上传文件)

> 上传方式有两种可选，上传至本地服务器或者七牛云，开发者根据自己需求选择

假设表单代码如下：

```

```

然后在控制器中添加如下的代码：

```
    // {date}代表目录占位符，image代表上传表单的name值
    $upload = new icarexm\file\Upload(ROOT_PATH);
    $file = $upload->putFile('uploads/{date}', 'image');
    //获取文件完整路径
    echo $file->getPathname();
    //获取文件相对路径
    echo $file->getSrcname();

```

默认情况下是上传到本地服务器，以微秒时间的`md5`编码为文件名的文件，例如上面生成的文件名可能是：

```
/uploads/2020-04-23/783b566c940ff4a95888a9ef1d9413.png

```

`{date}`变量就是`2020-04-23`目录的站位符，你可以动态的改变上传目录，占位符如下：

规则描述{type}文件类型{time}时间搓{md5\_time}md5后的时间搓{date}日期上传文件到七牛云
--------

[](#上传文件到七牛云)

假设表单代码如下：

```

```

然后在控制器中添加如下的代码：

```
    //上传文件到本地
    $upload = new icarexm\file\Upload(ROOT_PATH);
    $file = $upload->putFile('uploads/{date}', 'image');
    //获取文件完整路径
    $pathname = $file->getPathname();
    //设置七牛配置信息并上传
    $qiniuUpload = new icarexm\file\QiuniuUpload();
    $qiniu = $qiniuUpload->setConfig([
        'access'    => '***',
        'secret'    => '***',
        'bucket'    => '***',
        'domain'    => '***',
    ])->upload($pathname);
    //七牛文件名称
    echo $qiniu->getPathname();
    //七牛资源访问路径
    echo $qiniu->getSrcname();

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a45259241de6b05216481510f09ae2978e5dc161ed01a0ce68bf2eb097ffb34f?d=identicon)[icarexm](/maintainers/icarexm)

---

Top Contributors

[![icarexm](https://avatars.githubusercontent.com/u/65947546?v=4)](https://github.com/icarexm "icarexm (1 commits)")

### Embed Badge

![Health badge](/badges/icarexm-file/health.svg)

```
[![Health](https://phpackages.com/badges/icarexm-file/health.svg)](https://phpackages.com/packages/icarexm-file)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
