PHPackages                             netliva/symfony-filehelper - 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. netliva/symfony-filehelper

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

netliva/symfony-filehelper
==========================

Netliva File Helper Library

v1.1.0(8mo ago)027MITPHPPHP &gt;=7.4

Since Jun 27Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/netliva/symfony-filehelper)[ Packagist](https://packagist.org/packages/netliva/symfony-filehelper)[ RSS](/packages/netliva-symfony-filehelper/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (3)Versions (12)Used By (0)

Symfony FileHelper Bundle
=========================

[](#symfony-filehelper-bundle)

Symfony projelerinde dosya işlemleri için gelişmiş yardımcı araçlar sağlayan bundle.

Açıklama
--------

[](#açıklama)

Bu bundle, Symfony projelerinde dosya yönetimi, görüntü işleme ve dosya güvenliği için kapsamlı Twig extension'ları ve servisler sağlar. Dosya yükleme, görüntüleme, güvenli URL oluşturma ve dosya kontrolü işlemlerini kolaylaştırır.

Özellikler
----------

[](#özellikler)

- **Dosya Yönetimi**: Dosya yükleme, silme ve organizasyon
- **Görüntü İşleme**: Thumbnail oluşturma ve görüntü optimizasyonu
- **Güvenli URL'ler**: Dosyalara güvenli erişim için URL oluşturma
- **Twig Extension'ları**: Template'lerde kolay kullanım için Twig fonksiyonları
- **Dosya Kontrolü**: Dosya varlığı ve tip kontrolü
- **Event System**: Dosya işlemleri için event-driven yapı

Kurulum
-------

[](#kurulum)

```
composer require netliva/symfony-filehelper
```

### Bundle'ı Aktifleştir

[](#bundleı-aktifleştir)

```
// config/bundles.php
return [
    // ...
    Netliva\SymfonyFileHelperBundle\NetlivaSymfonyFileHelperBundle::class => ['all' => true],
];
```

Konfigürasyon
-------------

[](#konfigürasyon)

```
# config/packages/netliva_filehelper.yaml
netliva_filehelper:
    config:
        secure_uri_prefix: "/secure/media/"
        public_uri_prefix: "/public/media/"
        upload_dir: "%kernel.project_dir%/public/uploads"
        allowed_extensions: ["jpg", "jpeg", "png", "gif", "pdf", "doc", "docx"]
        max_file_size: 10485760  # 10MB
```

Kullanım
--------

[](#kullanım)

### Twig Fonksiyonları

[](#twig-fonksiyonları)

#### Dosya Yolu Alma

[](#dosya-yolu-alma)

```
{# Dosya yolunu al #}
{{ get_file_path('user_photos', 'profile', user.id) }}

{# Dosya varsa yolunu al #}
{{ get_file_path_if_exist('user_photos', 'profile', user.id) }}

{# Dosya varlığını kontrol et #}
{% if netliva_file_exists(file_path) %}

{% endif %}
```

#### Güvenli URL'ler

[](#güvenli-urller)

```
{# Güvenli medya URL'i #}

{# Genel medya URL'i #}

```

#### Dosya Görüntüleme

[](#dosya-görüntüleme)

```
{# Dosyayı görüntüle #}
{{ show_file('user_photos', 'profile', user.id, {
    'class': 'img-thumbnail',
    'width': 200,
    'height': 200
}) }}

{# Dosya listesi #}
{{ get_hard_file_list('user_photos', 'profile', {
    'class': 'file-list',
    'show_thumbnails': true
}) }}
```

#### Dosya Yükleme Widget'ları

[](#dosya-yükleme-widgetları)

```
{# Dosya yükleme butonu #}
{{ file_uploader_button('user_photos', 'profile', user.id, {
    'button_text': 'Fotoğraf Yükle',
    'class': 'btn btn-primary'
}) }}

{# Tam dosya yükleme widget'ı #}
{{ file_uploader('user_photos', 'profile', {
    'multiple': true,
    'accept': 'image/*',
    'max_size': 5242880
}) }}
```

### Twig Filtreleri

[](#twig-filtreleri)

```
{# Dosya uzantısını al #}
{{ file_path|get_extention }}

{# Yüklenen dosya sayısını al #}
{{ form.children.images|uploaded_count('images', 'user_') }}

{# Dosya thumbnail'i al #}
{{ file_path|get_file_thumbnail(150) }}

{# Boolean kontrolü #}
{{ value|is_true }}
```

### PHP Servisleri

[](#php-servisleri)

```
use Netliva\SymfonyFileHelperBundle\Services\NetlivaFileHelper;
use Netliva\SymfonyFileHelperBundle\Services\NetlivaImageHelper;

class FileController extends AbstractController
{
    public function upload(
        NetlivaFileHelper $fileHelper,
        NetlivaImageHelper $imageHelper
    ) {
        // Dosya yolu alma
        $filePath = $fileHelper->getFilePath('user_photos', 'profile', $userId);

        // Görüntü işleme
        $thumbnail = $imageHelper->createThumbnail($filePath, 200, 200);

        // Güvenli URL oluşturma
        $secureUrl = $fileHelper->mediaSecureUri($filePath);

        return $this->json([
            'file_path' => $filePath,
            'secure_url' => $secureUrl,
            'thumbnail' => $thumbnail
        ]);
    }
}
```

Event Sistemi
-------------

[](#event-sistemi)

### Event'ler

[](#eventler)

- `NetlivaFileHelperEvents::PUBLIC_URL`: Genel URL oluşturulurken
- `NetlivaFileHelperEvents::SECURED_URL`: Güvenli URL oluşturulurken

### Event Subscriber Örneği

[](#event-subscriber-örneği)

```
use Netliva\SymfonyFileHelperBundle\Event\PublicUrlEvent;
use Netliva\SymfonyFileHelperBundle\Event\NetlivaFileHelperEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class FileHelperSubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            NetlivaFileHelperEvents::PUBLIC_URL => 'onPublicUrl',
        ];
    }

    public function onPublicUrl(PublicUrlEvent $event): void
    {
        // URL'i özelleştir
        $path = $event->getPath();
        $customPath = '/custom/' . basename($path);
        $event->setPath($customPath);
    }
}
```

Dosya Grupları ve Kodları
-------------------------

[](#dosya-grupları-ve-kodları)

Bundle, dosyaları organize etmek için grup ve kod sistemi kullanır:

- **Grup**: Dosyaların kategorisi (örn: `user_photos`, `documents`, `products`)
- **Kod**: Grup içindeki alt kategori (örn: `profile`, `invoice`, `thumbnail`)

### Örnek Kullanım

[](#örnek-kullanım)

```
// Kullanıcı profil fotoğrafı
$fileHelper->getFilePath('user_photos', 'profile', $userId);

// Ürün görselleri
$fileHelper->getFilePath('products', 'main_image', $productId);

// Dokümanlar
$fileHelper->getFilePath('documents', 'invoice', $invoiceId);
```

Güvenlik
--------

[](#güvenlik)

- Dosya uzantısı kontrolü
- Maksimum dosya boyutu kontrolü
- Güvenli URL oluşturma
- Dosya erişim kontrolü

Performans
----------

[](#performans)

- Dosya varlığı cache'leme
- Thumbnail cache'leme
- Lazy loading desteği

Gereksinimler
-------------

[](#gereksinimler)

- PHP &gt;= 7.4
- Symfony &gt;= 5.4
- Doctrine ORM &gt;= 2.5
- Twig &gt;= 2.0

Lisans
------

[](#lisans)

MIT License

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance61

Regular maintenance activity

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

Every ~211 days

Recently: every ~77 days

Total

10

Last Release

243d ago

Major Versions

v0.0.7 → v1.0.02025-07-08

PHP version history (3 changes)v0.0.1PHP ^7.1.3

v0.0.6PHP ^7.2 || ^8.0

v1.0.1PHP &gt;=7.4

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/netliva-symfony-filehelper/health.svg)

```
[![Health](https://phpackages.com/badges/netliva-symfony-filehelper/health.svg)](https://phpackages.com/packages/netliva-symfony-filehelper)
```

###  Alternatives

[helios-ag/fm-elfinder-bundle

ElFinder bundle, adds ElFinder file manager to your Symfony project

2814.8M27](/packages/helios-ag-fm-elfinder-bundle)[artgris/filemanager-bundle

FileManager is a simple Multilingual File Manager Bundle for Symfony

182420.8k9](/packages/artgris-filemanager-bundle)

PHPackages © 2026

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