2017 © Pedro Peláez
 

library easy-php-file-info

Get file information from local and also remote file(mime type, extension, file name ...).

image

vincoweb/easy-php-file-info

Get file information from local and also remote file(mime type, extension, file name ...).

  • Wednesday, July 13, 2016
  • by vincoweb
  • Repository
  • 1 Watchers
  • 3 Stars
  • 144 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 9 % Grown

The README.md

easy-php-file-info

Get easily file information from local and also remote file (mime, extension, file name ...), (*1)

Installation

composer require vincoweb/easy-php-file-info=dev-master

Usage

$finfo = new \VincoWeb\FileInfo\FileInfo();
$i = $finfo->get($file_link [, bool $return_object = false ]);

Variable "$file_link" can contains path and also URL. Variable "$return_object" is optional. Set to true for return object instead of array., (*2)

Laravel support

add provider and alias in config/app.php, (*3)

'providers' => [
    ...
    VincoWeb\FileInfo\FileInfoServiceProvider::class
]

...

'aliases' => [
    ...
    'FileInfo'  => VincoWeb\FileInfo\FileInfoFacade::class,
],

and in laravel you use it, (*4)

    FileInfo::get($file_link [, bool $return_object = false ]);

Example

Code

<?php
require __DIR__ . '/../vendor/autoload.php';

$finfo = new \VincoWeb\FileInfo\FileInfo();

$i = $finfo->get('https://www.google.sk/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png');

Result

Array ( [link] => https://www.google.sk/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png [mime] => image/png [size] => 13504 [last_modified] => Fri, 04 Sep 2015 22:33:08 GMT [etag] => [extension] => png [type] => image [location] => url [width] => 544 [height] => 3 )

Result returns array with these keys: * link - where file was finded (if there was redirection, it contains reditected location) * location - location of $file_link ( return string "URL" or "path") * mime - mime type (only from header, if $link is URL). * size - file size (if is taken from header, it can contain value "-1") * last_modified - date of last modified * etag - file header etag from ULR (can be empty) or md5 hash of file from path * basename - basename, name of file * extension - file extension got from header(if file is image, it contains real extension ) * type - mime type or string "image" if file is normal image * [width] - width dimension, this key exists only if file is image * [height] - height dimension, this key exists only if file is image, (*5)

It can return boolean false (i.e. if file not exist)., (*6)

Features

IF YOU WANT NEW FEATURES WRITE NEW ISSUE PLS :), (*7)

Licence

Unlicense. You can do what you want. Be free!, (*8)

The Versions

13/07 2016

dev-master

9999999-dev

Get file information from local and also remote file(mime type, extension, file name ...).

  Sources   Download

unlicensed

The Requires

  • php >=5.5.0

 

by Martin Vincenc

php file info image info file data

13/07 2016

v1.0.6

1.0.6.0

Get file information from local and also remote file(mime type, extension, file name ...).

  Sources   Download

unlicensed

The Requires

  • php >=5.5.0

 

by Martin Vincenc

php file info image info file data

13/07 2016

dev-developer

dev-developer

Get file information from local and also remote file(mime type, extension, file name ...).

  Sources   Download

unlicensed

The Requires

  • php >=5.5.0

 

by Martin Vincenc

php file info image info file data

19/03 2016

v1.0.5

1.0.5.0

Get file information from local and also remote file(mime type, extension, file name ...).

  Sources   Download

unlicensed

The Requires

  • php >=5.5.0

 

by Martin Vincenc

php file info image info file data

13/03 2016

v1.0.4

1.0.4.0

Get file information from local and also remote file(mime type, extension, file name ...).

  Sources   Download

unlicensed

The Requires

  • php >=5.5.0

 

by Martin Vincenc

php file info image info file data

12/03 2016

v1.0.3

1.0.3.0

Get file information from local and also remote file(mime type, extension, file name ...).

  Sources   Download

unlicensed

The Requires

  • php >=5.5.0

 

by Martin Vincenc

php file info image info file data

07/03 2016

v1.0.1

1.0.1.0

Get file information from local and also remote file(mime type, extension, file name ...).

  Sources   Download

unlicensed

The Requires

  • php >=5.5.0

 

by Martin Vincenc

php file info image info file data