Download the PHP package baraja-core/path-resolvers without Composer

On this page you can find all versions of the php package baraja-core/path-resolvers. 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 path-resolvers

πŸ—‚οΈ Path Resolvers

A group of intelligent DI services that provide disk paths to important locations such as tempDir, wwwDir, vendorDir, logDir and other system constants for your applications. Dependency management can be easily solved from one place.

🎯 Key Features

πŸ—οΈ Architecture

The package follows a hierarchical resolver pattern where each resolver can depend on others:

🧩 Components

VendorResolver

The core resolver that detects the Composer vendor directory. It uses multiple detection strategies:

  1. Primary method: Reflects on Composer\Autoload\ClassLoader to find its file location
  2. CLI fallback: For PHAR or system-installed PHP, uses debug backtrace to locate vendor
  3. Error handling: Throws RuntimeException if vendor cannot be detected

RootDirResolver

Resolves the project root directory by getting the parent directory of vendor. Supports custom path appending.

WwwDirResolver

Resolves the public web directory. Uses intelligent detection:

  1. If custom wwwDir is provided via constructor, uses that
  2. If called from index.php, returns its directory
  3. Falls back to {root}/www

TempDirResolver

Resolves the temporary directory. Supports custom paths and directory names.

LogDirResolver

Resolves the log directory. Supports custom paths and directory names.

πŸ“¦ Installation

It's best to use Composer for installation, and you can also find the package on Packagist and GitHub.

To install, simply use the command:

You can use the package manually by creating an instance of the internal classes, or register a DIC extension to link the services directly to the Nette Framework.

Requirements

πŸš€ Basic Usage

With Nette Framework (Recommended)

Register the extension in your config.neon:

All resolvers are automatically registered as services and can be injected:

Standalone Usage (Without Nette)

You can use the resolvers without the DI extension:

βš™οΈ Configuration

Custom Paths via DI

Override default paths in your Nette configuration:

Constructor Parameters

Resolver Parameter Type Default Description
TempDirResolver tempDir ?string null Custom absolute path to temp directory
TempDirResolver tempDirName string 'temp' Directory name relative to root
LogDirResolver logDir ?string null Custom absolute path to log directory
LogDirResolver logDirName string 'log' Directory name relative to root
WwwDirResolver wwwDir ?string null Custom absolute path to www directory

πŸ’‘ Use Cases

Storing Cache Files

Writing Log Files

Serving Static Files

Project Configuration

πŸ”§ Technical Details

Path Normalization

All resolvers normalize directory separators using DIRECTORY_SEPARATOR for cross-platform compatibility:

Caching

The VendorResolver uses static caching to prevent redundant filesystem operations:

CLI Detection

For CLI environments running from PHAR archives or system-installed PHP, the vendor resolver uses debug backtrace as a fallback detection method.

πŸ‘€ Author

Jan BarΓ‘Ε‘ek https://baraja.cz

πŸ“„ License

baraja-core/path-resolvers is licensed under the MIT license. See the LICENSE file for more details.


All versions of path-resolvers with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
nette/di Version ^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 baraja-core/path-resolvers contains the following files

Loading the files please wait ...