Download the PHP package x-wp/di without Composer

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

XWP-DI

Dependency Injection Container for WordPress

[![Packagist Version](https://img.shields.io/packagist/v/x-wp/di?label=Release&style=flat-square)](https://packagist.org/packages/x-wp/di) ![Packagist PHP Version](https://img.shields.io/packagist/dependency-v/x-wp/di/php?label=PHP&logo=php&logoColor=white&logoSize=auto&style=flat-square) ![Static Badge](https://img.shields.io/badge/WP-%3E%3D6.4-3858e9?style=flat-square&logo=wordpress&logoSize=auto) [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/x-wp/di/release.yml?label=Build&event=push&style=flat-square&logo=githubactions&logoColor=white&logoSize=auto)](https://github.com/x-wp/di/actions/workflows/release.yml)

This library allows you to implement dependency injection design pattern in your WordPress plugin or theme. It provides a simple and easy-to-use interface to manage dependencies and hook callbacks.

Key Features

  1. Reliable - Powered by PHP-DI, a mature and feature-rich dependency injection container.
  2. Interoperable - Provides PSR-11 compliant container interface.
  3. Easy to use - Reduces the boilerplate code required to manage dependencies and hook callbacks.
  4. Customizable - Allows various configuration options to customize the container behavior.
  5. Flexible - Enables advanced hook callback mechanisms.
  6. Fast - Dependencies are resolved only when needed, and the container can be compiled for better performance.

Installation

You can install this package via composer:

[!TIP] We recommend using the automattic/jetpack-autoloader with this package to prevent autoloading issues.

Usage

Below is a simple example to demonstrate how to use this library in your plugin or theme.

Creating the Application and Container

You will need a class which will be used as the entry point for your plugin/theme. This class must have a #[Module] attribute to define the container configuration.

After defining the module, you can create the application using the xwp_create_app function.

Using handlers and callbacks

Handler is any class which is annotated with a #[Handler] attribute. Class methods can be annotated with #[Action] or #[Filter] attributes to define hook callbacks.

Documentation

For more information, please refer to the official documentation.


All versions of di with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
automattic/jetpack-constants Version ^2
php-di/php-di Version ^7
symfony/polyfill-php81 Version ^1.31
x-wp/helper-classes Version ^1.13
x-wp/helper-functions Version ^1.13
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 x-wp/di contains the following files

Loading the files please wait ....