Skip to content

CoreyFile

Corey Avis edited this page Sep 25, 2026 · 4 revisions

File Management

The CoreyFile class provides a robust, object-oriented interface for interacting with the server's filesystem. It abstracts standard PHP file functions into an intuitive API for reading, writing, editing, and retrieving metadata from files.

Table of Contents

  1. Usage
  2. Parameters
  3. Public Methods
  4. Internal Methods
  5. Public Properties
  6. Configuration Options

Usage

$file = new CoreyFile(array $userConfig);

Parameters

userConfig : An array of initial configuration options which seamlessly merges into the master CoreyPHP configuration array; alternatively, use setConfig() to update these values later.

Public Methods

Environment

The following methods are responsible for managing the state, metadata, and operations of the files and folders you interact with.

Structure

The following methods are responsible for creating, editing, and modifying files and folders.

Conversion

The following methods facilitate format conversion.

Date and Time

The following methods are used to generate and manipulate date and time variables.

  • fileDate - Formats a Unix timestamp to a human-readable date format

Image Generation

The following methods are used to create images using the CoreyPHP Color Code Utility System.

  • createJpg - Create JPG image file using CoreyPHP color code
  • createPng - Create PNG image file using CoreyPHP color code

Static Site Generator

  • startCode - Initializes output buffer
  • endCode - Captures the buffered output and writes to file

Validation

The following methods provide type-checking utilities to verify data integrity, ensuring that inputs conform to expected formats.

  • isEmpty - Checks if folder is empty

Version Control

The following methods help to generate standardized version strings for software releases, continuous integration build identifiers, and nightly builds.

Internal Methods

The following methods are either private or protected. They are documented here for developers who wish to extend this class.

Helpers

Public Properties

Variable Description Example
file The trimmed filename. $file->file
bytes The file size in bytes $file->bytes
size The file size converted. $file->size
created Date file was created. $file->created
modified Date file was last modified. $file->modified
accessed Date file was last accessed. $file->accessed
path The absolute directory path of the current working directory. $file->path

Configuration Options

Refer to the Configuration Documentation section for a complete overview.


Home | CoreyFile

Clone this wiki locally