Download the PHP package sigmaphp/sigmaphp-filesystem without Composer

On this page you can find all versions of the php package sigmaphp/sigmaphp-filesystem. 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 sigmaphp-filesystem

SigmaPHP-Filesystem

The SigmaPHP-Filesystem package provides a simple and consistent interface for working with files and directories. It abstracts common filesystem operations such as creating, reading, writing, copying, moving, renaming, and removing files and directories.

The package is designed to keep filesystem operations straightforward while providing a reusable interface that can be integrated into SigmaPHP applications and other PHP projects.

Installation

Documentation

Basic Usage

The Filesystem class provides the implementation of FilesystemInterface and can be instantiated directly when filesystem operations are required.

Once the filesystem instance has been created, it can be used to perform common file and directory operations.

For example, a file can be created and written to using the following:

The same instance can then be used to read the file:

Available Methods

list()

Lists all files inside a directory and its sub-directories.

Parameter Type Description
$path string The directory path to search.
$includeFullPath bool Whether to include the full path for each file.
$withExtension bool Whether to include file extensions.

Returns an array of file paths or file names.

exists()

Checks whether a file or directory exists.

Parameter Type Description
$path string The file or directory path.

Returns true when the path exists, otherwise false.

dirHas()

Checks whether a directory contains a specific file or subdirectory.

Parameter Type Description
$path string The directory to search.
$target string The file or subdirectory to look for.

Returns true when the target exists inside the directory.

create()

Creates a new file with the specified permissions.

Parameter Type Description
$path string The path of the file to create.
$permission int The permissions to assign to the file.

Returns true when the file is created successfully.

rename()

Renames a file or directory.

Parameter Type Description
$old string The current path.
$new string The new path.

Returns true when the operation succeeds.

copy()

Copies a file to another location.

Parameter Type Description
$src string The source file path.
$dest string The destination path.

Returns true when the file is copied successfully.

move()

Moves a file to another location.

Parameter Type Description
$src string The source file path.
$dest string The destination path.

Returns true when the file is moved successfully.

remove()

Removes a file.

Parameter Type Description
$path string The file path to remove.

Returns true when the file is removed successfully.

write()

Writes content to a file. Existing content may be replaced.

Parameter Type Description
$path string The file path.
$content mixed The content to write.

Returns true when the content is written successfully.

append()

Appends content to the end of an existing file.

Parameter Type Description
$path string The file path.
$content mixed The content to append.

Returns true when the content is appended successfully.

read()

Reads content from a file.

Parameter Type Description
$path string The file path.
$offset int The position from which to start reading.
$length int The maximum amount of content to read.

Returns the file content as a string.

createDir()

Creates a directory.

Parameter Type Description
$path string The directory path to create.
$permission int The permissions to assign to the directory.
$recursive bool Whether parent directories should also be created.

Returns true when the directory is created successfully.

removeDir()

Removes a directory and its contents.

Parameter Type Description
$path string The directory path to remove.

Returns true when the directory and its contents are removed successfully.

License

(SigmaPHP-Filesystem) released under the terms of the MIT license.


All versions of sigmaphp-filesystem with dependencies

PHP Build Version
Package Version
No informations.
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 sigmaphp/sigmaphp-filesystem contains the following files

Loading the files please wait ...