Download the PHP package christianblos/symfony-di-annotation without Composer

On this page you can find all versions of the php package christianblos/symfony-di-annotation. 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 symfony-di-annotation

What's this?

This library is an extension of the Symfony DependencyInjection Component. It allows you to configure the DI Container using annotations directly in your classes.

Set up

1. Install via composer:

composer require christianblos/symfony-di-annotation

2. Add compiler pass to the ContainerBuilder

(see symfony documentation for more information about the ContainerBuilder)

Basic Usage

Just add the @Service annotation to all of your services and they will be registered to the DIC automatically:

Now you can simply retrieve the service from the container:

Note: You can also add multiple @Service annotations if you want to configure two services of the same class. Then you also need to set the id of the service like @Service(id="myService") because you can not have two services with the same id (By default, the id is the full class name).

Inject params

You can also inject params by adding it to the annotation:

Modify container

It is possible to modify the whole container by using method annotations. One possible use case is an event listener. Depending on your implementation it could look like this:

Note: This is just an example of what is possible. The "ListenTo" Annotation is not implemented in this library! See the example of how you can implement it.

More examples

You can find some examples in the examples folder.


All versions of symfony-di-annotation with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
doctrine/annotations Version ~1.0
symfony/dependency-injection Version >=4.0
symfony/config Version >=4.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 christianblos/symfony-di-annotation contains the following files

Loading the files please wait ....