Download the PHP package webiik/container without Composer

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

Container

The Container adds handy methods to most common Pimple functions and then adds automatic injection of dependencies from container to class constructor.

Installation

Example

Adding

addService

addService() ads service factory to container. It returns always same instance of service.

If you need to access container inside $factory:

addServiceFactory

addServiceFactory() ads service factory to container. It returns always new instance of service.

addParam

addParam() ads parameter to container.

addFunction

addFunction() ads function to container.

Check

isIn

isIn() checks if service, parameter or function is stored in container.

Getting

get

get() returns service, parameter or function from container.

Dependency Injection

Container provides automatic dependency injection from Container to class controller using the method injectTo(string $className): array. However it requires to follow these naming conventions:

Inject Service by Class Name

  1. Add service with same name as full name of underlying class:

  2. Use full class name as type parameter in controller in your class:

    Container will search for service with name \Webiik\Arr\Arr.

  3. Inject dependencies to class:

Inject Service by Service Name

  1. Add service with name matching the following regex ws[A-Z]:

  2. Add class name alias to your class:

  3. Add doc block with parameter type to controller of your class:

    Container will search for service with name wsArray.

  4. Inject dependencies from container to your class: php $container->addFunction('myFnName', function() { echo 'Hello!'; });
  5. Use parameter name in constructor in your class:

    Container will search for parameter with name myParamName.

  6. Inject dependencies from container to your class:

Inject Container Itself

  1. Use full Container class name as type parameter in constructor in your class:

  2. Inject dependencies from container to your class:

Resources


All versions of container with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
pimple/pimple Version ^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 webiik/container contains the following files

Loading the files please wait ....