Skip to content

koppava/xi-filelib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Filelib

Filelib is a file library for PHP. See the wiki for more documentation.

Requirements

  • PHP 5.3.x
  • A database for storing metadata like MySQL, PostgreSQL, SQLite or MongoDB

Quickstart

Using Doctrine ORM

Filelib must have a place to store both files and file metadata.

  1. Use a database schema from /docs/ to initialize your database tables.

For MySQL

mysql -uroot -p filelib_example < schema-mysql.sql
  1. Configure Filelib with directory paths for private and public and make them writable by the web server.
<?php

use Xi\Filelib\FileLibrary;
use Xi\Filelib\Storage\FilesystemStorage;
use Xi\Filelib\Backend\Platform\DoctrineOrmPlatform;
use Xi\Filelib\Publisher\Filesystem\SymlinkFilesystemPublisher;

/**
 * @var $entityManager Doctrine\ORM\EntityManager
 */

$filelib = new FileLibrary(
    new FilesystemStorage('/path/to/my/application/data/private'),
    new DoctrineOrmPlatform($entityManager),
    new SymlinkFilesystemPublisher('/path/to/my/application/web/files', '/files')
);

$file = $filelib->upload('/path/to/some/file.jpg');

For integration, see:

Build Status

Usage

Explaining the mandatory subsystems:

Virtual filesystem with folders and files.

  • ACL handles ACL
  • Backend / Platform handles metadata storage
  • Publisher publishes
  • Storage stores physical files

About

File library for PHP 5.3

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%