Download the PHP package aklump/glob without Composer

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

glob

A replacement for PHP's glob() that understands **, for recursive path matching without a shell call.

Summary

PHP's own glob() stops at one directory level. There is no **, so finding every .php file under src/ means writing a recursive walk or shelling out to find. This package adds the missing piece: \AKlump\Glob\Glob::glob() takes the patterns you already write and reads ** as "any number of directories". Patterns without ** are handed straight to the native glob(), so the common case costs nothing extra. Matches come back absolute and sorted, directories carry a trailing slash, and a matched symlink brings its target along with it. It exists because the other glob-replacement packages available at the time returned unexpected results.

Quick Start

Install the package:

Then match across directory levels:

A relative pattern is resolved against the current working directory, and the matches come back absolute and sorted:

Requirements

PHP 7.3 or newer. The unit tests are run against 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 and 8.5 by bin/run-multi-phpunit-tests.sh.

Everything else arrives through Composer: aklump/gitignore for pattern matching, plus symfony/filesystem, crysalead/dir and psr/simple-cache. No PHP extension has to be enabled and there is no binary to install. Symfony's Path class did not exist before symfony/filesystem 5.4, so this package ships its own and aliases it in when Symfony's is absent; ^4 works as well as ^6.4.

Installation

The package is autoloaded under the AKlump\Glob\ namespace by PSR-4, so Composer's autoloader is the whole of the setup.

To work on the package itself:

bin/run-phpunit-tests.sh runs the same suite and writes an HTML coverage report to reports/html, which needs Xdebug or PCOV. bin/run-multi-phpunit-tests.sh runs it under every supported PHP version and needs aklump/phpswap.

Usage

One call at a time, or many

Glob::glob() builds a new instance for every call, and each instance builds its own file-list cache the first time it runs. That makes the static call safe by default: it can never hand you a stale listing.

When you are about to run several patterns against a tree that is not changing, reuse one instance and the cache is built once:

The trade is yours to manage. An instance keeps its cache for as long as it lives, so if the file system changes underneath it, discard it and make a new one.

Testing a path against a pattern

Glob::match() answers the same question without touching the disk:

What the patterns mean

Patterns follow gitignore's pattern format, which is where ** comes from.

License

BSD-3-Clause


All versions of glob with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
aklump/gitignore Version ^0.0
symfony/filesystem Version ^4 || ^5.4 || ^6.4
crysalead/dir Version ^2.0
psr/simple-cache Version ^1.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 aklump/glob contains the following files

Loading the files please wait ...