Download the PHP package edvin/hbcontainer without Composer

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

HbContainer

A PSR-11 lightweight dependency injection container for all types of projects. Supports php 8.0 and newer.

Installation

With composer:

Resolving

HbContainer uses definitions to define entries to be resolved by the container. The container can resolve any class that can be constructed with resolvable dependencies on its own. Resolved definitions are by default stored as weak references and can be set as singletons which will use a normal reference.

Getting entries

The HbContainer has three primary methods to get/call entries:

  1. get: Resolve and runtime-caches the resolved value for the next call.
  2. make: Always resolve and return a new instance.
  3. call: Resolve the provided argument as something to call and resolve its parameters.

The HbContainer takes an DefinitionSource that contains several definitions that tell the container how to resolve the specific entry. The different types are:

  1. DefinitionFactory: An definition with an closure to return the item in its final state. The result is added to the singleton cache. Helper function: \HbLib\Container\factory
  2. DefinitionClass: An definition to construct a class with or without provided parameters. If any parameters are defined, the class is never runtime-cached. Helper function: \HbLib\Container\resolve. Its optional to provide an class to this definition, and if none is provided it will assume the definition ID (index of the definition array) is the class name. See usage example below.
  3. DefinitionReference: An definition to reference another definition entry, you may not provide parameters to this definition. Helper function: \HbLib\Container\reference.
  4. DefinitionValue: An definition to return some value. The value itself can be another definition. Helper function: \HbLib\Container\value.

Interfaces

When depending on the container, it is recommended to depend on the provided interfaces:

  1. \Psr\Container\ContainerInteface: Provides the get method.
  2. \HbLib\Container\FactoryInterface: Provides the make mehod.
  3. \HbLib\Container\InvokerInterface: Provides the call mehod.

Usage

Compiling

The container supports compiling all resolved definitions to increase performance. The advantage of this in production environments is that the container does not need to look up all parameters everytime, but rather has all definitions and their dependencies resolved in one file.

How to

Compiling must be enabled on ContainerBuilder and some script must call writeCompiled:

Somewhere in your web app:

I do recommend that the ContainerBuilder::writeCompiled call is performed in a separate cli command so that errors does not affect your clients.


All versions of hbcontainer with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0 <9.0
psr/container Version ^1.0|^2.0
laravel/serializable-closure Version ^1.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 edvin/hbcontainer contains the following files

Loading the files please wait ....