Download the PHP package loilo/find-up without Composer

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

FindUp

Tests Version on packagist.org

Find a file by walking up ancestor directories (e.g. a composer.json from inside a project).

Installation

Usage

Basic Example

example.php:

This is the most basic example how to use this package. The finder will look for a composer.json file, starting at the directory where Up::find() was called (which is /var/www/project/src/foo).

Note: If there was no composer.json on the way up, the find method would return null.

Starting Directory

As can be seen in the basic example above, the default starting directory is the one from where Up::find() is called. Alternatively, a starting directory can be passed to the find method as a second argument:

Advanced Matching

Instead of a file name to search for, a (non-string) callable may be passed as the find method's first argument. It will receive each encountered file on the way up and decides whether it is the searched file.

Assuming we're starting in the example.php from the basic example directory tree above, we can find the path to the composer.json with the following call:

Stop Searching Prematurely

You can stop the search before reaching the filesystem root by returning an Up::stop() call. For example, if you know that your composer.json is not found upwards from the /var/www folder, you can break out of the search:

When returning Up::stop(), the Up::find() method will return null by default.

You may however pass a path to the stop() method that will be used as the result. If the path is not absolute, it will be resolved against the current $directory:

Note: In previous versions, the way to stop searching was to return the Up::STOP constant.

This technique still works, but it's deprecated and it's recommended to use Up::stop() instead.

Skip Folder

If you are in a directory of which you're sure it does not contain the searched file, you may avoid walking through all its files by returning Up::skip():

By default, the Up::skip() method will only skip the currently scanned directory. You may however pass a (positive) number that indicates how many levels of directories should be skipped.

Note: In previous versions, the way to skip scanning a folder was to return the Up::SKIP constant.

This technique still works, but it's deprecated and it's recommended to use Up::skip() instead.

Jump to Other Folder

If you want to stop searching the current directory tree altogether and continue from another path, you can return an Up::jump() call:

Note: You can only jump to a directory you have not previously visited in the current search. This serves to avoid infinite loops.


All versions of find-up with dependencies

PHP Build Version
Package Version
Requires php Version >= 7.1
loilo/traceback Version ^1.0
loilo/node-path 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 loilo/find-up contains the following files

Loading the files please wait ....