Download the PHP package thomasmarinissen/class-dependency-resolver without Composer
On this page you can find all versions of the php package thomasmarinissen/class-dependency-resolver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download thomasmarinissen/class-dependency-resolver
More information about thomasmarinissen/class-dependency-resolver
Files in thomasmarinissen/class-dependency-resolver
Package class-dependency-resolver
Short Description A Class Dependency Resolver for PHP
License MIT
Informations about the package class-dependency-resolver
Class Dependency Resolver
Description
The PHP Class Dependency Resolver is a library designed to facilitate providing context to Large Language Models by
resolving dependencies of PHP classes/files. It maps fully qualified class names, interfaces, and traits to their
corresponding file paths and manages the direct dependencies between files. The main entry point to the library is
the Resolver
class.
Table of Contents
- Installation
- Basic Usage
- Configuration
- Examples
- Contributing
- Testing
- License
Installation
To install the Class Dependency Resolver library, use Composer:
Ensure that your PHP version is compatible (PHP 8.3 or higher) and that you have Composer installed on your system.
Basic Usage
To use the Class Dependency Resolver, you need to initialize the Resolver
class with the directories you want to scan
for PHP files. Here is a basic example:
This example demonstrates how to initialize the resolver, build the dependency maps, and retrieve file paths and dependencies.
Configuration
The Resolver
class allows you to specify the PHP version you want to target when parsing files. By default, it uses
the host's PHP version. You can specify a different version by passing a PhpVersion
instance to the constructor:
This allows you to ensure compatibility with different PHP versions when resolving dependencies.
Examples
Example 1: Resolving Class Dependencies
Example 2: Handling Multiple Directories
Example 3: Resolving Class Dependencies by file path
These examples illustrate how to resolve dependencies for classes or files and handle multiple directories.
Contributing
Contributions are welcome! If you wish to contribute to the Class Dependency Resolver project, please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Make your changes and ensure that all tests pass.
- Submit a pull request with a clear description of your changes.
Please adhere to the coding standards and include tests for any new functionality.
Testing
To run the tests for the Class Dependency Resolver library, you need to have PHPUnit installed. You can run the tests using the following command:
This command will execute the PHPUnit tests defined in the tests
directory. Ensure that all tests pass before
submitting any contributions.
License
This project is licensed under the MIT License - see the LICENSE file for details.