PHPackages                             petrknap/php-filestorage - 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. petrknap/php-filestorage

Abandoned → [petrknap/php-splitfilesystem](/?search=petrknap%2Fphp-splitfilesystem)ArchivedLibrary[File &amp; Storage](/categories/file-storage)

petrknap/php-filestorage
========================

File storage for PHP

v1.1.2(9y ago)232MITPHPPHP &gt;=5.5

Since May 6Pushed 8y ago1 watchersCompare

[ Source](https://github.com/petrknap/php-filestorage)[ Packagist](https://packagist.org/packages/petrknap/php-filestorage)[ Docs](https://github.com/petrknap/php-filestorage)[ RSS](/packages/petrknap-php-filestorage/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (8)Dependencies (5)Versions (10)Used By (0)

File storage for PHP
====================

[](#file-storage-for-php)

- [About resolved issue](#about-resolved-issue)
    - [Advantages](#advantages)
    - [Disadvantages](#disadvantages)
- [Usage of php-filestorage](#usage-of-php-filestorage)
    - [Standard usage](#standard-usage)
- [How to install](#how-to-install)

About resolved issue
--------------------

[](#about-resolved-issue)

> I need to use something where around 60,000 files with average size of 30kb are stored in a single directory (this is a requirement so can't simply break into sub-directories with smaller number of files).
>
> The files will be accessed randomly, but once created there will be no writes to the same filesystem. I'm currently using Ext3 but finding it very slow. Any suggestions?
>
> \-- [Filesystem large number of files in a single directory - bugmenot77, voretaq7](http://serverfault.com/q/43133)

This file storage solves this issue simply - it **creates virtual layer between file system and application**. Every path is converted into path which is composed from many directories which contains only small amount of sub-directories.

If you wish to store 1 000 000 files in single directory, this file storage converts paths and stores them in huge tree-structure. Every directory (exclude leafs) contains up to 256 sub-directories. Leafs contains only files.

### Advantages

[](#advantages)

- Can store a huge amount of files in single directory
- Can use fully localized paths to files (f.e.: `/シックス.log`)
- Naturally protects files outside the storage
- Every user can has separated and isolated file storage
- Fully compatible and based on [League\\Flysystem](https://github.com/thephpleague/flysystem)

### Disadvantages

[](#disadvantages)

- Real file structure is not user-friendly
- Can not effectively get files sorted by any key (without DBMS)

Usage of php-filestorage
------------------------

[](#usage-of-php-filestorage)

### Standard usage

[](#standard-usage)

```
