2017 © Pedro Peláez
 

library skeleton-file

Tigron File utilities

image

tigron/skeleton-file

Tigron File utilities

  • Monday, July 16, 2018
  • by tigron
  • Repository
  • 2 Watchers
  • 0 Stars
  • 3,952 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 14 Versions
  • 9 % Grown

The README.md

skeleton-file

Description

This library makes it easy to handle user uploaded files or files created by your application. Files will be stored on disk, meta data in database. This library automatically stores files in a structured way on disk with unique filenames., (*1)

Installation

Installation via composer:, (*2)

composer require tigron/skeleton-file

Create a new table in your database:, (*3)

CREATE TABLE `file` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    `path` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    `md5sum` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
    `mime_type` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
    `size` bigint(20) NOT NULL,
    `expiration_date` datetime DEFAULT NULL,
    `created` datetime NOT NULL,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Howto

Initialize the file store:, (*4)

\Skeleton\File\Config::$file_path = $some_very_cool_path;

/**
 * \Skeleton\File\Config::$store_dir is deprecated
 * $store_dir added directory 'file' to the defined path
 *
 * \Skeleton\File\Config::$file_dir is deprecated
 *
 * Please use $file_path instead
 */

Upload a file:, (*5)

$file = \Skeleton\File\File::upload($_FILES['upload']);

Create a new file:, (*6)

$file = \Skeleton\File\File::store('filename.txt', 'this is the content');

Copy a file:, (*7)

$file2 = $file->copy();

Delete a file:, (*8)

$file->delete();

Get the content of the file:, (*9)

$contents = $file->get_contents();

Get the path of the file on disk:, (*10)

$path = $file->get_path();

Send the file to the browser (download):, (*11)

$file->client_download();

Get a file by his ID, (*12)

$file = File::get_by_id(1);

The Versions

16/07 2018
16/07 2018

v0.2.9

0.2.9.0

Tigron File utilities

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

26/06 2018

v0.2.8

0.2.8.0

Tigron File utilities

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

17/05 2018

v0.2.7

0.2.7.0

Tigron File utilities

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

06/03 2018

v0.2.6

0.2.6.0

Tigron File utilities

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

22/12 2017

v0.2.5

0.2.5.0

Tigron File utilities

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

22/12 2017

v0.2.4

0.2.4.0

Tigron File utilities

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

21/12 2016

v0.2.3

0.2.3.0

Tigron File utilities

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

31/08 2016

0.2.2

0.2.2.0

Tigron File utilities

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

20/07 2016

v0.2.1

0.2.1.0

Tigron File utilities

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

14/06 2016

v0.2.0

0.2.0.0

Tigron File utilities

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

27/11 2015

v0.1.1

0.1.1.0

Tigron File utilities

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

19/10 2015

v0.1.0

0.1.0.0

Tigron File utilities

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

14/08 2015

v0.0.1

0.0.1.0

Tigron File utilities

  Sources   Download

MIT

The Development Requires

by Tigron BVBA