PHPackages                             attwframework/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. attwframework/file

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

attwframework/file
==================

File component of AttwFramework

09PHP

Since Sep 28Pushed 11y ago1 watchersCompare

[ Source](https://github.com/AttwFramework/file)[ Packagist](https://packagist.org/packages/attwframework/file)[ RSS](/packages/attwframework-file/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

File
====

[](#file)

[![Total Downloads](https://camo.githubusercontent.com/2cc0abe0852ce561f2f1778788d9a883156c23d2a5c847c67dc13d929748b904/68747470733a2f2f706f7365722e707567782e6f72672f617474776672616d65776f726b2f66696c652f646f776e6c6f6164732e706e67)](https://packagist.org/packages/attwframework/file) [![Latest Unstable Version](https://camo.githubusercontent.com/88be9f44898ef29f0736a0c88ff2e848377d900cdf67fdd15ced349d77123e21/68747470733a2f2f706f7365722e707567782e6f72672f617474776672616d65776f726b2f66696c652f762f756e737461626c652e706e67)](https://packagist.org/packages/attwframework/file) [![License](https://camo.githubusercontent.com/ebc9bd5a2771a2657241aeab347ea333be4dd5a8eda30462190f0c985cf063df/68747470733a2f2f706f7365722e707567782e6f72672f617474776672616d65776f726b2f66696c652f6c6963656e73652e706e67)](https://packagist.org/packages/attwframework/file)

File component of [AttwFramework](https://github.com/attwframework/framework).

\##Composer ###Download

```
{
    "require": {
        "attwframework/file": "dev-master"
    }
}
```

\##How to use A file is represented with the class `Attw\File\File`.

Pass in it constructor an array with file datils (global variable $\_FILES).

```
use Attw\File\File;

//...

$file = new File($_FILES['file']);
```

All components of namespace `Attw\File` use the file class. ###Upload To upload a file, use the class `Attw\File\Uploader\Uploader`.

The method used to upload a file is `Attw\File\Uploader\Uploader::upload($file, $directory)`.

```
use Attw\File\File;
use Attw\File\Uploader\Uploader;

//...

$file = new File($_FILES['file']);
$uploader = new Uploader();
if($uploader->upload($file, 'public/files')){
    //success
}
```

\###File validators Also have the possibility of validate the files.

The validators are:

- `Attw\File\Validator\MaxSize`: Don't allow that a file have more than specified maximum size
- Constructor: `Attw\File\Validator\MaxSize::__construct($maxSize)`. `$maxSize` must be an integer and indicated in MB
- `Attw\File\Validator\MinSize`: Don't allow that a file have more than specified minimum size
- Constructor: `Attw\File\Validator\MinSize::__construct($minSize)`. `$minSize` must be an integer and indicated in MB
- `Attw\File\Validator\Extension`: Don't allow that a file have a invalid extension
- Constructor: `Attw\File\Validator\Extenction::__construct($extensions)`. `$extensions` must be an array with the allowed extensions.
- `Attw\File\Validator\Type`: Don't allow that a file have a invalid type
- Constructor: `Attw\File\Validator\Type::__construct($types)`. `$types` must be an array with the allowed types.

```
use Attw\File\File;
use Attw\File\Validator\Extension;

//...

$file = new File($_FILES['file']);
$validator = new Extension([ 'jpg', 'png', 'gif' ]);

if($validator->validate($file)){
    //success
}
```

If you wanna throw an exception (`Attw\File\Validator\Exception\FileValidatorException`) when the validation fail, execute the method `Attw\File\Validator\SomeValidator::exception($on = false)` with the param `$on` as `true`.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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/4fcbdf815749595d3dcfd4fb781e2cac05aa6d132123aa9da889d2c5ca6c8e11?d=identicon)[GabrielJMJ](/maintainers/GabrielJMJ)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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