Download the PHP package rock-symphony/container without Composer

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

RockSymphony Service Container

Build Status StyleCI

An indie Service Container implementation based on Laravel Container.

Philosophy

Features

Usage

Installation

Use composer.

Basics

Of course you can put services to container (->set()) and get them from it (->get()), as well as check if container has specific service (->has()).

Using abstract interfaces

It's handy to bind services by their abstract interfaces to explicitly declare it's interface on both definition and consumer sides.

Aliases

Sometimes you may also want to bind the same service by different IDs. You can use aliases for that (->alias()):

Binding to a resolver function

You can declare a service by providing a resolver closure function (->bindResolver()). Service container will call that function every time you resolve service.

Deferred resolution service binding

You can defer service initialization until it is requested for the first time. A resolver function will be called just once and its result will be stored to service container.

It works similar to ->bindResolver(), but stores result after first invocation.

Extending a bound service

You can extend/decorate an existing service binding with ->extend() method.

Isolated extension to service container

A use-case: you want to create a new container inheriting services from the existing one. But you don't want to re-define the services again, using the originally defined ones. Also you want to provide more services, without modifying the original container.

Think of it as JavaScript variables scopes: a nested scope inherits all the variables from parent scope. But defining new scope variables won't modify the parent scope. That's it.

Automatic dependency injection

Dependency-injecting construction

You can construct any class instance automatically injecting class-hinted dependencies from service container. It will try to resolve dependencies from container or construct them recursively resolving their dependencies.

Dependency-injecting method call

You can call any callable automatically injecting dependencies from service container. It's primarily intended, but not limited, to call application HTTP controllers.

Note: Service container only resolves class-hinted arguments (i.e. arguments explicitly type-hinted to a class). You should provide required scalar arguments with second argument. It will use default value for options arguments (if you don't specify them).

FAQ

  1. Why not use Laravel Container?

    We were using Laravel Container for our project internally. But it's a bad candidate to link it as library as:

    • It doesn't follow SemVer – BC breaks on every minor version bump
    • It has unneeded dependency to flooded illuminate/contracts
    • It's designed to be used as part of Laravel Framework, thus it's almost unusable as-a-library
    • You can use all laravel components only at certain version (i.e. all at 5.3; or all at 5.4; but not mixing)
    • If you want to move forward you are forced to upgrade to latest PHP version (i.e. container 5.4 requires PHP 7.0)
    • Bloated public API: 31 public API methods (vs 10 public methods in this library)
    • Questionable method naming: what's the difference between ->make() and ->build()?

License

This project is licensed under the terms of the MIT license.


All versions of container with dependencies

PHP Build Version
Package Version
Requires php Version ^5.4|^7.0
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 rock-symphony/container contains the following files

Loading the files please wait ....