PHP Classes

PHP File Info: Get several types of information about files

Recommend this page to a friend!
  Info   View files Documentation   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-09 (2 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 370 This week: 1All time: 6,807 This week: 571Up
Version License PHP version Categories
file-info 0.1.13GNU General Publi...5.3PHP 5, Files and Folders
Description 

Author

This class can get several types of information about files.

It takes a given file name and if it exists in can return several details about that file.

Currently it returns the file directory path, base name, file name extension, and the detected MIME type based on the file name extension.

Picture of Nathan Bishop
  Performance   Level  
Name: Nathan Bishop <contact>
Classes: 2 packages by
Country: Australia Australia
Age: 33
All time rank: 307437 in Australia Australia
Week rank: 420 Up3 in Australia Australia Up

Documentation

FileInfo

[![Build Status][build-img]][build-url] [![Code Climate][gpa-img]][gpa-url] [![Test Coverage][coverage-img]][coverage-url]

Provides a simple and flexible API wrapper around PHP's pathinfo method.

Installation

The recommended way of installing this package is through Composer:

$ composer require nbish11/fileinfo

Basic Usage

<?php
require 'vendor/autoload.php';
$finfo = new FileInfo('C:/path/to/file.txt');

// Using standard API methods:
echo $finfo->getDirectory(); // 'C:/path/to/'
echo $finfo->getBaseName();  // 'file.txt'
echo $finfo->getExtension(); // 'txt'
echo $finfo->getFileName();  // 'file'
echo $finfo->getMimeType();  // 'text/plain'

// Using class properties:
echo $finfo->directory; // 'C:/path/to/'
echo $finfo->basename;  // 'file.txt'
echo $finfo->extension; // 'txt'
echo $finfo->filename;  // 'file'
echo $finfo->mimetype;  // 'text/plain'

Contributing

> Please see CONTRIBUTING.

<a name="license"></a>License

> Copyright &copy; 2016 Nathan Bishop > > Please see LICENSE for more information.

[build-url]: https://travis-ci.org/nbish11/FileInfo [build-img]: https://travis-ci.org/nbish11/FileInfo.svg?branch=master [gpa-url]: https://codeclimate.com/github/nbish11/FileInfo [gpa-img]: https://codeclimate.com/github/nbish11/FileInfo/badges/gpa.svg [coverage-url]: https://codeclimate.com/github/nbish11/FileInfo/coverage [coverage-img]: https://codeclimate.com/github/nbish11/FileInfo/badges/coverage.svg


  Files folder image Files  
File Role Description
Files folder imagesrc (2 files)
Files folder imagetests (1 file)
Accessible without login Plain text file .codeclimate.yml Data Auxiliary data
Accessible without login Plain text file CONDUCT.md Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file FileInfo.php Class Class source
  Accessible without login Plain text file mediatypes.json Data Auxiliary data

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file FileInfoTest.php Test Unit test script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:370
This week:1
All time:6,807
This week:571Up