Download the PHP package hco/auto-wiring-bundle without Composer

On this page you can find all versions of the php package hco/auto-wiring-bundle. 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 auto-wiring-bundle

HCO Auto Wiring Bundle

This bundle eases the usage of the symfony2 DIC by injecting (constructor) dependencies automatically.

All classes that should be autowired have to have a specific tag within the DIC. The Bundle will then iterate over the constructor-parameters and will try to find a service that satisfies the typehint of every parameter.

If there is not exactly one service that satisfies the typehint, the autowiring will fail. Qualifiers and Primary Services might help you to solve that issue, though :)

The autowiring process is done during compile time of the service container, which means that it should not have any performance impact in production.

Stability

I already use this bundle in an application, and it's working quite well. I am not yet releasing a 1.0 though, as I'm looking forward to feedback and experiences.

I intend to keep every change backwards compatible.

Qualifiers

A service can have a so called "qualifier", which will allow autowiring of typehints which could be satisfied by several services.

An example could be your database connection. Imagine, you have two database connections within your service container, one for write requests and one for readonly requests. You could now give both services a qualifier, "write" for the write-database connection and "readonly" for the readonly database connection.

If a service now has an unqualified typehint for a database connection, the autowiring will fail. But you can now qualify a typehint with the string we used before, so that a service will be wired to one specific database connection.

Primary Services

A service an be tagged to be a so called primary service. When a dependency should be outwired, and there is exactly one primary service, that will be outwired. There can still be several non-primary services for a class, but they will be ignored.

If two services are declared to be primary which are of the same type, the compilation of the container will fail.

Example

Imagine you define the following class with the following service configuration

This will automatically inject the service bar into the service foo.

Example with qualifiers

We're gonna reuse the ServiceWithDependency class from above, but modify the service configuration.

That will fail, as the autowiring bundle does not know which service should be injected anymore. This is where qualifiers come into play. We can slightly modify the class and service definition.

This will injcet the service baz into the service foobar, as baz is qualified as readonly.

Qualifiers can also be configured within the XML:

Something similar will work with YAML, as i just use tags on services.

Example with Primary

If we tag the service baz as primary, it will be used as the StdClass dependency of our ServiceWithDependency. See the following services.xml as an example.

License

This bundle is under the MIT license. See the complete license in the LICENSE file in the root of this repository.


All versions of auto-wiring-bundle with dependencies

PHP Build Version
Package Version
Requires doctrine/annotations Version ~1.1
symfony/dependency-injection Version ~2.3
symfony/config Version ~2.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 hco/auto-wiring-bundle contains the following files

Loading the files please wait ....