Download the PHP package comphp/di without Composer

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

CommonPHP Dependency Injection

CommonPHP\DependencyInjection is a simple yet powerful dependency injection (DI) container for PHP applications, enabling the means to dynamically create new objects, invoke methods, call functions and populate properties without having to know the structure of the target directly.

Features

Requirements

The CommonPHP framework requires PHP 8.3 or newer. This library specifically has the following dependencies:

Installation

You can install CommonPHP\DependencyInjection using Composer:

Basic Usage

Instantiating Classes

The main component is the DependencyInjector class, which is responsible for injecting the passed parameters into a constructor, method or function.

Populating Object Properties

The DependencyInjector can also populate the properties of an object:

Custom Lookup Hooks

The ValueFinder class allows you to add custom lookup hooks:

Delegating Class Instantiation

For classes requiring specific instantiation logic, the DependencyInjector offers a delegate method. This method allows you to specify a custom callback for creating instances of a specific class, providing greater control over the object creation process.

Documentation

For more in-depth documentation, check out the Wiki.

API Reference

This is a high-level overview of the API. For detailed information about classes, methods, and properties, please refer to the source code and accompanying PHPDoc comments.

Examples

Here are some examples of using CommonPHP\DependencyInjection. You can find the full source code for these examples in the examples directory of this repository.

Contributing

Contributions are always welcome! Please read the contribution guidelines first.

Testing

This project uses PHPUnit for unit testing. Follow the instructions below to run the tests:

  1. Ensure you have PHPUnit installed. If not, you can install it with Composer:

  2. Navigate to the project's root directory.

  3. Run the tests using the following command:

  4. If the tests are successful, you will see output similar to:

We recommend regularly running these tests during development to help catch any potential issues early. We also strive for a high level of test coverage, and additions to the codebase should ideally include corresponding tests.

For more detailed output or for integration into continuous integration (CI) systems, PHPUnit can generate a log file in a variety of formats. Check the PHPUnit documentation for more information.

License

This project is licensed under the MIT License. See the LICENSE.md file for details.


All versions of di with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
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 comphp/di contains the following files

Loading the files please wait ....