PHPackages                             sateler/yii2-document - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. sateler/yii2-document

ActiveYii2-extension[PDF &amp; Document Generation](/categories/documents)

sateler/yii2-document
=====================

Yii2 model for storing documents

1.1.3(6y ago)0577MITPHP

Since Jul 14Pushed 6y ago2 watchersCompare

[ Source](https://github.com/sateler/yii2-document)[ Packagist](https://packagist.org/packages/sateler/yii2-document)[ RSS](/packages/sateler-yii2-document/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (2)Versions (8)Used By (0)

Yii2 plugin for a document model
================================

[](#yii2-plugin-for-a-document-model)

Yii2-document stores documents in your local database or any filesystem supported by [Flysystem](https://flysystem.thephpleague.com/).

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist sateler/yii2-document "^1.1"

```

or add

```
"sateler/yii2-document": "^1.1"

```

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

Once the extension is installed, add namespace to console config:

```
return [
    'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationNamespaces' => [
                'sateler\document\migrations',
            ],
        ],
    ],
];
```

And controller to web config:

```
return [
    'controllerMap' => [
        'documents' => [
            'class' => 'sateler\document\controllers\DocumentController',
        ]
    ],
];
```

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

[](#configuration)

```
'documentManager' => [
    'class' => \sateler\document\DocumentManager::class,
    // Define default filesystem, of none given sql storage is used
    'defaultFilesystemId' => 'awsS3',
    'filesystems' => [
        // A flysystem filesystem config
        'awsS3' => [
            'class' => AwsS3Filesystem::class,
            'bucket' => 'bucket-name',
            'region' => 'us-east-1',
            'prefix' => 'path',
            'key' => 'key',
            'secret' => 'secret',
        ],
    ],
],
```

Usage
-----

[](#usage)

Once installed, you can now use `sateler\document\Document` in your relations, and redirect to `['documents/view', 'id' => $docId]` to view or download.

Create a document and save it:

```
$doc = new Document();
$doc->name = 'filename';
$doc->mime_type = 'mime/type';
$doc->contents = file_get_contents('/path/to/file');
$doc->save();
```

Get a document and send it:

```
$doc = Document::findOne($id)
$res = Yii::$app->response;
$res->format = Response::FORMAT_RAW;
$res->setDownloadHeaders($doc->name, $doc->mime_type, true);
$res->data = $doc->contents;
$res->send();
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 60.7% 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

Every ~206 days

Recently: every ~258 days

Total

6

Last Release

2239d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0dccda8434771641535b87b5ba40f569fa695da1f03dd2ef81c02d851bc175c1?d=identicon)[fsateler](/maintainers/fsateler)

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

---

Top Contributors

[![rsateler](https://avatars.githubusercontent.com/u/1533946?v=4)](https://github.com/rsateler "rsateler (17 commits)")[![gbordoni](https://avatars.githubusercontent.com/u/13774052?v=4)](https://github.com/gbordoni "gbordoni (7 commits)")[![fsateler](https://avatars.githubusercontent.com/u/1322013?v=4)](https://github.com/fsateler "fsateler (4 commits)")

---

Tags

yii2extensiondocument

### Embed Badge

![Health badge](/badges/sateler-yii2-document/health.svg)

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

###  Alternatives

[yii2assets/yii2-pdfjs

Yii2 Extension pdf.js Portable Document Format (PDF) viewer

23215.3k](/packages/yii2assets-yii2-pdfjs)[phpnt/yii2-export

Yii2 It saves data in xls, csv, word, html, pdf files.

158.9k](/packages/phpnt-yii2-export)

PHPackages © 2026

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