Download the PHP package crysalead/box without Composer

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

Box - Minimalist Dependency Injection Container

Build Status Code Coverage

Box is dependency injection container which manage dependencies based on closure definitions only. This approch has the particularity to be simple, easy and flexible. It also support lazy dependencies resolution using wrappers.

API

Creating a Dependency container

Setting up a service

To to share a unique service over your application use Box::service(). A service can be a class, an instance, a string or any kind of value.

Example:

Each shared service defined with Box::service() can be retreived using Box::get().

Note: If a share is defined using a closure, the closure will be executed once and the result will be returned for all next Box::get() calls.

Setting up a factory

Use Box::factory() to setup a factory. It can be a closure:

Or a fully-namespaced class name.

Box::factory() will create an new instance of the definition when resolved using Box::get().

Resolving a dependency

To resolve a dependency, use Box::get():

All $paramX are optional parameters passed to the closure or directly to the constructor if the definition is a fully-namespaced class name string.

Returing a wrapped dependency

Wrapping a dependency has the advantage to allow to inject a dependency without resolving it directly. To be able to lazily resolve a dependency you need to use Box::wrap():

All $paramX are optional parameters passed to the closure or directly to the constructor if the definition is a fully-namespaced class name string.

Then dependency is resolved by doing:

All $paramX are optional and will overrides the ones setted at the wrapping step.

Cleanup

Use Box::remove('foo') to remove a specific dependency or Box::clear() to remove all dependencies.

Global API

You can use the box() function to get/set a DI anywhere in your code.

Setter

Getter

Unsetting a DI

Clear everything.


All versions of box with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
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 crysalead/box contains the following files

Loading the files please wait ....