Download the PHP package wexample/php-file without Composer

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

php-file

Version: 2.0.0

wexample/php-file holds the file handling that owes nothing to a framework: reading a tree off the disk, deciding which paths a list of patterns takes, and putting a size into words. It requires PHP alone, so a command-line script, a worker or a Symfony bundle can all reach for it — ../symfony-file is the Symfony wiring built on top of this one.

Installation

Reading a tree

src/Class/FileSystemItemScanner.php is built on a root and confined to it: a path leading outside, by .. or through a symlink, comes back as nothing rather than as an error. It reads one level at a time, because a directory holding node_modules or .git is not something a caller can afford to receive whole.

Each entry is a plain array keyed by the KEY_* constants — path, name, type, whether it has children, size, modification time and permissions. What becomes of it, a row or a listing or a checksum, is the caller's business.

src/Enum/FileSystemItemType.php is the type it carries: FILE, DIRECTORY or LINK. A link is told apart from what it points at, so a broken one still describes.

Matching paths

src/Class/PathMatcher.php reads the vocabulary of a .gitignore: rules in order, the last one to speak wins, ! gives back what the lines above took, ** crosses directories where * stops at one.

Nothing said about a path is nothing taken: a list of rules is a list of what to keep. couldMatchUnder() answers off the patterns and never off the disk, which is what lets a tree skip a branch it has never opened.

Sizes

src/Helper/FileSizeHelper.php goes both ways, and the two directions are kept together so a multiplier can never be changed on one side alone.

Units are binary — a KB is 1024 — and read in French as well as English, since both spellings turn up in the configuration files this parses.

Table of Contents

Architecture

The package declares no dependency but PHP itself, and that is its whole point: it is where file code lands once it stops needing a framework. Anything reaching for a container, an entity manager or a Twig environment belongs in ../symfony-file instead — the rule is easy to check, since adding such a thing to composer.json is the moment it breaks.

Three kinds, each in its own directory under src/, as the suite's PHP design rules ask:

A file moved between those directories has its namespace moved with it, or PSR-4 stops finding it.

What is answered, and what is not

src/Class/FileSystemItemScanner.php answers plain arrays keyed by its own KEY_* constants, never rows and never objects. That is deliberate: an index, a listing and a checksum want the same stat and disagree on everything else, so the shape is left to whoever asked. symfony-file turns those arrays into a Doctrine entity; a script would print them.

Containment is resolved rather than forbidden: toContainedAbsolutePath() runs realpath() on the root plus the relative path and answers null for anything landing outside. Reading into a symlink leading out is refused by that; describing the link itself is not, since it belongs to the directory holding it.

src/Class/PathMatcher.php exists here rather than in a front end because the same vocabulary has to answer two questions — what a tree draws, and what a mass action applies to. Two implementations of a syntax with this many corners is two implementations that disagree.

Consumers

../symfony-file and ../symfony-helpers both depend on this package. The second only for src/Helper/FileSizeHelper.php, behind two deprecated delegations kept so that callers of FileHelper::formatBytes() and FileHelper::convertToBytes() keep working while they move over.

Integration in the Suite

This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.

Related Packages

The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.

Visit the Wexample Suite documentation for the complete package ecosystem.

Dependencies

Versioning & Compatibility Policy

Wexample packages follow Semantic Versioning (SemVer):

We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Free to use in both personal and commercial projects.

About us

Wexample stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.

This packages suite embodies this spirit. Trusted by professionals and enthusiasts alike, it delivers a consistent, high-quality foundation for modern development — open, elegant, and battle-tested. Its reputation is built on years of collaboration, refinement, and rigorous attention to detail, making it a natural choice for those who demand both robustness and beauty in their tools.

Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.

Migration Notes

When upgrading between major versions, refer to the migration guides in the documentation.

Breaking changes are clearly documented with upgrade paths and examples.


All versions of php-file with dependencies

PHP Build Version
Package Version
Requires php Version >=8.5
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 wexample/php-file contains the following files

Loading the files please wait ...