Download the PHP package martinmuzatko/filehandler without Composer

On this page you can find all versions of the php package martinmuzatko/filehandler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filehandler

FileHandler

As lazy I am, when it comes to php function redundancy, I prefer to create my own tools rather than retyping the entire file open call over and over again.

I am using this self-made FileHandler for years now, and I still can't find a viable alternative.

Optional Requirements

Make sure to enable finfo (fileinfo) php extension to get and in

Installing

Via Composer:

or add it as dependency:

Usage

Include the files or use autoloader.

Using the methods below, you can easily create, write, rename, read files. While FileHandler is a set of static methods, File serves a convenient way of quickly modifying files.

FileHandler Examples

Checking Image Dimensions

File Examples

Batch creating customer directories

Constants

Methods

FileHandler (Static)

Methods are called statically (FileHandler::getInfo())

getInfo($file)

Return fileinformation as object Example:

Returns these informations:

Paths

Dimensions

Timestamps and other Properties

Permissions

Checks - Boolean

getAsArray($file)

Returns file content as array.

read($file)

Return File as string if it exists

write($file, $content, $seperator = CRLF)

Overwrites File with given string or array, returns true if succeeded.

create($file, $content = '')

Creates File but does not overwrite existing files.

delete($file)

Delete file if existing.

rename($old, $new)

Rename a File from old path to new path

appendFile($targetFile, $file, $seperator = CRLF)

Appends $file to $targetFile with given seperator.

appendLine($targetFile, $content, $seperator = CRLF)

Appends $content to $targetFile with a defined $seperator

clearFile($file)

Clears file from any content

listFiles($path = '.', $includeFiles = true, $includeFolders = true)

List all files within a valid directory as array

File (Method Chaining)

The constructor and some other methods accepts any of these:

After constructing, the File contains ANY info retrievable via e.g.

create()

Create file, accepts no param, file is entered via constructur:

copy($target)

delete()

rename($name)

move($target)

Moving file to desired location, will automatically create all directories needed for new location example:

will move index.php to and will create the folders , and

chmod($octet)

Changing the file permissions from 0111 to 0777

merge($target) work in progress

read()

Get file contents. Method chaining after calling this method is not possible anymore.

concat($content, $separator = CRLF)

Adding content to a file.

write($content)

Write as in overwrite (use concat if you want to add to the file instead of overwriting)

find($lookup)

Find files in a directory, regex enabled. Retrievable via or

EXAMPLES:

Find by string:

Find by Regex:

Find by Property - Value pairs with operators:

Operators: <, >, <=, >=, !

Properties are used by getInfo()

get()

This method is used as final method to get selections made by find() or select() or new File() Returns path if no selection is done.

select()

Selecting files by paths array of paths array of Files array of File Selections You can also mix these

Examples



Any array or array of arrays will be traversed down to create an one-dimensional array saved to public property $selection. Selections are retrievable by get()


All versions of filehandler with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package martinmuzatko/filehandler contains the following files

Loading the files please wait ....