Download the PHP package monkeyscloud/monkeyslegion-di without Composer

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

MonkeysLegion DI

A production-ready PSR-11 dependency injection container for PHP 8.4+ with auto-wiring, PHP attributes, interface binding, and compiled container support.

Installation

Quick Start

Features

Auto-Wiring

The container resolves constructor dependencies automatically by inspecting type hints — no configuration needed for concrete classes:

Factory Definitions

Register services with factory closures for full control over instantiation:

Runtime Registration

Register or override services at runtime:

Interface Binding

Map abstractions to concrete implementations:

PHP 8.4 Attributes

#[Inject] — Override Parameter Resolution

#[Transient] — Fresh Instance Every Time

#[Singleton] — Explicit Singleton (Default Behavior)

#[Tagged] — Service Aggregation

Service Tagging (Programmatic)

Transient Lifecycle (Programmatic)

Builder Pattern

Use ContainerBuilder for structured setup with providers:

Compiled Container (Production)

Pre-compile the container for faster boot times in production:

Static Instance & ContainerAware Trait

For scenarios where constructor injection is not possible (e.g., legacy code or deep inheritance), the container supports a global static instance and a helper trait.

1. Bootstrap Setup:

2. Using ContainerAware Trait:

Testing Support

API Reference

Container

Method Description
setInstance(Container $container): void Sets the global static instance.
instance(): self Retrieves the global instance (throws if not set).
resetInstance(): void Clears the global static instance.
get(string $id): mixed Resolve a service (PSR-11)
has(string $id): bool Check if service exists (PSR-11)
set(string $id, callable\|object $def): void Register/override at runtime
bind(string $abstract, string $concrete): void Map interface → implementation
tag(string $id, string\|array $tags): void Tag a service
getTagged(string $tag): array Get all services with a tag
transient(string $id): void Mark as non-singleton
reset(): void Clear cached instances
getDefinitions(): array Get registered definitions

ContainerBuilder

Method Description
addDefinitions(array $defs): self Merge definitions (won't overwrite)
set(string $id, callable\|object $def): self Register single definition
bind(string $abstract, string $concrete): self Map interface → implementation
tag(string $id, string\|array $tags): self Tag a service
transient(string $id): self Mark as non-singleton
enableCompilation(string $dir): self Enable compiled container
build(): Container Build the container

ContainerAware Trait

Method Description
resolve(string $id): mixed Resolves a service from the global container.
has(string $id): bool Checks if a service exists.
container(): ContainerInterface Returns the global container instance.

Attributes

Attribute Target Description
#[Inject('id')] Parameter Override auto-wired parameter
#[Singleton] Class Explicit singleton (default)
#[Transient] Class New instance per get()
#[Tagged('tag')] Class Auto-register tag (repeatable)

Error Handling

The container throws PSR-11 compliant exceptions:

Requirements

Testing

License

MIT


All versions of monkeyslegion-di with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
psr/container Version ^2.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 monkeyscloud/monkeyslegion-di contains the following files

Loading the files please wait ...