PHPackages                             hnr/helper - 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. hnr/helper

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

hnr/helper
==========

hnrHelper main objective is especially for uploading and retrieving your uploaded files (images or documents) outside yii web directory for security reason.

06PHP

Since Mar 17Pushed 10y ago1 watchersCompare

[ Source](https://github.com/rabbasa/hnrHelper)[ Packagist](https://packagist.org/packages/hnr/helper)[ RSS](/packages/hnr-helper/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

HNR Helper
==========

[](#hnr-helper)

File Uploader

Tujuannya adalah untuk menyimpan file uploadan di luar folder web di Yii, kemudian orang dapat mengaksesnya melalui url dengan memasukkan id dan nama file yang di-request

informasi dari file yang diupload disimpan di dalam database dengan informasi :

- id
- filename
- filename\_real
- size
- content\_type
- created\_at
- updated\_at
- id tambahan untuk referensi misalnya : id\_publikasi, id\_member, id\_blog, dsb

file migrasi untuk create tabel:

```
    $this->createTable('t_media_file', [
        'id'            => $this->primaryKey(),
        'id_member'     => $this->integer()->notNull(),
        'album_type'    => $this->smallInteger(1), //PROFIL,OTHER
        'is_main'       => $this->smallInteger(1)->defaultValue(0),
        'filename'      => $this->string(230), // image or cover photo
        'filename_real' => $this->string(250),
        'size'          => $this->integer()->defaultValue(0),
        'content_type'  => $this->string(75),
        'created_at'    => 'integer' ,
        'updated_at'    => 'integer' ,
    ]);

```

misal upload diletakkan di D:/UPLOAD (kalau windows), atau \_FILES di luar folder web di Yii

script ada di C:/htdocs/app1/backend/web

url

url file gambar :

url file pdf : untuk kasus pdf, dibuat controller :

- nama kontroller : MediaController
- nanti ada action : actionDoc($id,$name) yang menerima parameter id : 19, nama file di database : namadoc.pdf tujuan dari namadoc.pdf adalah untuk memvalidasi, apakah record dengan id 19 nama nya sama dengan namadoc.pdf agar tidak ada orang yang mengarang2 menginput id 20, 21, dst

contoh url Mapper :

```
        'rules' => array(
                'media/img/////'  => 'media/img',
                'media/doc//'                 => 'media/doc',
                '///' => '/',
                '//'         => '/',
                '/'                  => '/',

```

[http://localhost/app1/media/doc?id=19&amp;name=namadoc.pdf](http://localhost/app1/media/doc?id=19&name=namadoc.pdf)

$get=\\yii::$app-&gt;request-&gt;get(); $get\['id'\] $get\['name'\]

File-file yang diletakkan di file system sebaiknya direname dengan menghilangkan spasi, koma, kurung, dsb, diganti dengan \_ atau -

###  Health Score

20

—

LowBetter than 13% 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/96676b9cbaa063429f857027a6ba86362740424637523b3d202f8ed751112820?d=identicon)[rabbasa](/maintainers/rabbasa)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/hnr-helper/health.svg)

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

###  Alternatives

[venveo/craft-compress

Create smart zip files from Craft assets on the fly

124.7k](/packages/venveo-craft-compress)

PHPackages © 2026

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