Download the PHP package jshannon63/cobalt without Composer

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

Build Status StyleCI

Cobalt - An Autowired Dependency Injection Container for PHP

Realized in fewer than 160 lines of source.

Well documented, perfect for building/learning.

100% PHPUnit test coverage

One of the fastest PHP dynamic autowired containers available

Cobalt was created to push the performance limits on what a PHP based dynamic autowired DI container can achieve. The Container::class implements the PSR-11 ContainerInterface and provides many of the features found in more notable container projects. Additionally, dependency caching capabilities make the Cobalt container a great choice for performance intensive applications. Cobalt and its simplistic code are perfect for learning or for use within projects or frameworks.

The Cobalt service container has the following features:

  1. Single class container implementing the PSR-11 ContainerInterface.
  2. ArrayAccess methods for container bindings.
  3. Constructor injection of type-hinted dependencies.
  4. Dependency injection through bind method closures.
  5. Autowired dependency resolution using Reflection.
  6. Top down inversion of control (IoC).
  7. Shared mode option (singleton only).
  8. Bind existing instances into the container.
  9. A self-binding global container instance.

Installation

Usage

Creating the container

Binding into the container

Binding does not instantiate the class. Instantiation is deferred until requested from the container. The bind method accepts 3 parameters... the abstract name, the concrete implementation name and a true or false for defining as a singleton. Notice in all three versions we use different abstract names. This is to show that the abstract name is free-form and is used as the "key" for array storage of bindings.

bind($abstract, $concrete=null, $singleton=false)

Resolving out of the container

$instance = resolve($abstract); (resolve checks for existing binding before instantiating)

Note: Trying to resolve will throw an exception if the requested binding does not exist.

Using the make() method

The make method will bind() then resolve() to return a fully instantiated binding.

$instance = make($abstract, $concrete, $singleton=false)

Creating an alias to a binding

alias($alias, $binding)

Allows creating additional $id string keys for accessing existing container bindings.

Binding an existing instance

$instance = instance($abstract, $instance)

Note: The instance method is deprecated but retained for backward compatibility. Instead, use bind($id, $instance) to register an existing intance.

Checking if a binding exists

$bool = has($abstract)

Get the values of a single binding

$array = getBinding($abstract)

Getting a list of bindings

$array = getBindings()


All versions of cobalt with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
psr/container Version ^1.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 jshannon63/cobalt contains the following files

Loading the files please wait ....