PHPackages                             salamek/nette-files - 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. salamek/nette-files

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

salamek/nette-files
===================

File storage for Nette Framework

2.1.5(2y ago)01961BSD-3-ClausePHP

Since Mar 20Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Salamek/nette-files)[ Packagist](https://packagist.org/packages/salamek/nette-files)[ RSS](/packages/salamek-nette-files/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (2)Dependencies (6)Versions (18)Used By (1)

Nette Files
===========

[](#nette-files)

This is a file storage for [Nette Framework](http://nette.org/)

Nette Files implements virtual directory structure (`IStructure`, `IStructureRepositry`) all files are stored in `dataDir` as their md5sum.ext, file info is implemented in `IStructureFile`, `IStructureFileRepository` and position of file in structure is implemented in `IFile` and `IFileRepository`

Instalation
-----------

[](#instalation)

The best way to install salamek/nette-files is using [Composer](http://getcomposer.org/):

```
$ composer require salamek/nette-files
```

Then you have to register extension in `config.neon`.

```
    extensions:
        files: Salamek\Files\DI\FilesExtension

    files:
        dataDir: %wwwDir%/data
        webTempDir: %wwwDir%/webtemp
        webTempPath: 'webtemp'
        iconDir: %wwwDir%/assets/file
```

You will need to implement:

- IFile entity representing single file
- IFileRepository repository for IFile
- IStructure entity representing single structure item (Folder/Directory)
- IStructureRepository repository for IStructure
- IStructureFile entity representing connection of IFile to IStructure (in what folder is what file)
- IStructureFileRepository repository for IStructureFile

Package contains trait, which you will have to use in class, where you want to use file storage. This works only for PHP 5.4+, for older version you can simply copy trait content and paste it into class where you want to use it.

```
