PHPackages                             daxslab/yii2-rawfileparser - 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. daxslab/yii2-rawfileparser

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

daxslab/yii2-rawfileparser
==========================

RawFileParser is a Yii2 extension that allows you to parse the content of requests that contain a raw file based on the `Content-Type` header. It does this by making the file available in the `$\_FILES` array, allowing to handle it as a regular file upload.

1.0.0(2y ago)13MITPHP

Since Jul 5Pushed 2y ago2 watchersCompare

[ Source](https://github.com/daxslab/yii2-rawfileparser)[ Packagist](https://packagist.org/packages/daxslab/yii2-rawfileparser)[ RSS](/packages/daxslab-yii2-rawfileparser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Yii2 Raw File Parser
====================

[](#yii2-raw-file-parser)

RawFileParser is a Yii2 extension that allows you to parse the content of requests that contain a raw file based on the `Content-Type` header. It does this by making the file available in the `$_FILES` array, allowing to handle it as a regular file upload.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist daxslab/yii2-rawfileparser "*"

```

or add

```
"daxslab/yii2-rawfileparser": "*"

```

to the require section of your `composer.json` file.

Configuration
-------------

[](#configuration)

In order to enable this parser you should configure \[\[Request::parsers\]\] in the following way:

```
return [
    'components' => [
        'request' => [
            'parsers' => [
                'application/zip' => [
                    'class' => 'daxslab\extensions\RawFileParser',
                    'basename' => 'azipfile' //optional but recommended, the name to locate the file in $_FILES
                ],
                'video/x-matroska' => 'daxslab\extensions\RawFileParser', //basename is not specified, the key $_FILES is a md5 hash of the file content. Ugly, yes...
            ],
        ],
        // ...
    ],
    // ...
];
```

Usage
-----

[](#usage)

**Note:** in order to the parser to be able to work:

1. The request must have the `Content-Type` header set to to specified value in the parser configuration
2. `Yii::$app->request->getBodyParams()` or `Yii::$app->request->post()` must be called previous to any attemp to access the file because is when the parser logic is executed.

### Handling the uploaded file

[](#handling-the-uploaded-file)

```
Yii::$app->request->getBodyParams(); //parser is executed here, the file is on $_FILES now.
$uploadedFile = UploadedFile::getInstanceByName('azipfile');

if (!$uploadedFile) {
     throw new ServerErrorHttpException(Yii::t('app', 'No file uploaded'));
}

$uploadedFile->saveAs("/path/to/save/$uploadedFile->name");
```

---

By [Daxslab](http://daxslab.com).

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1039d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13596248?v=4)[Gabriel Alejandro López López](/maintainers/glpzzz)[@glpzzz](https://github.com/glpzzz)

---

Top Contributors

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

---

Tags

requestfilebinaryuploadyii2extensionraw

### Embed Badge

![Health badge](/badges/daxslab-yii2-rawfileparser/health.svg)

```
[![Health](https://phpackages.com/badges/daxslab-yii2-rawfileparser/health.svg)](https://phpackages.com/packages/daxslab-yii2-rawfileparser)
```

###  Alternatives

[mohorev/yii2-upload-behavior

Upload behavior for Yii 2

128265.5k9](/packages/mohorev-yii2-upload-behavior)[nemmo/yii2-attachments

Extension for file uploading and attaching to the models

6616.6k5](/packages/nemmo-yii2-attachments)[liyunfang/yii2-upload-behavior

Upload behavior for Yii 2

161.7k](/packages/liyunfang-yii2-upload-behavior)

PHPackages © 2026

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