PHP Classes

PHP File Info: Get several types of information about files

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-09 (9 months ago) RSS 2.0 feedNot enough user ratingsTotal: 372 All time: 6,792 This week: 71Up
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: 307038 in Australia Australia
Week rank: 206 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 (8)  
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 (8)  /  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 (8)  /  tests  
File Role Description
  Accessible without login Plain text file FileInfoTest.php Test Unit test script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:372
This week:0
All time:6,792
This week:71Up