Download the PHP package olvlvl/symfony-dependency-injection-proxy without Composer

On this page you can find all versions of the php package olvlvl/symfony-dependency-injection-proxy. 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-dependency-injection-proxy

Proxy generator for Symfony's DIC

Release Packagist Code Quality Code Coverage

This package provides a proxy generator for Symfony's dependency injection component that generates super tiny, super simple proxies, especially when compared to Symfony's default implementation. Here are some differences:

If you're not familiar with proxy services, better have a look at Symfony's documentation before going any further.

Installation

How it works

The generator works with the following assumptions: the service we want to proxy implements an interface, and services using that service expect that interface, following the dependency inversion principle. Now, consider the following code, where an ExceptionHandler service requires a logger implementing LoggerInterface:

Imagine we're using Monolog as logger, and we have an expansive stream to set up. Why waste time building the logger for every request when it's seldom used? That's when we mark our service as lazy.

The following example demonstrates how we can mark our Psr\Log\LoggerInterface service as lazy (we could use PHP code or XML just the same):

The service can also use a factory:

Note: We don't have to define our service with a class, we could use logger instead of Psr\Log\LoggerInterface just > the same, except we would have to define class for the factory one.

Now let's see how to build our container.

Building the dependency injection container

The following code demonstrates how to build, compile, and dump a container:

There you have it. We can use our container as usual and everything is awesome.

What if my lazy service implements multiple interfaces?

The basic interface resolver will have a hard time figuring out which interface to implement if a service implements many. For instance, if a service was an instance of ArrayObject the following exception would be thrown:

We can specify the interface to implement using the lazy attribute:


Continuous Integration

The project is continuously tested by GitHub actions.

Tests Static Analysis Code Style

Code of Conduct

This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you are expected to uphold this code.

Contributing

Please see CONTRIBUTING for details.

License

olvlvl/symfony-dependency-injection-proxy is released under the BSD-3-Clause.


All versions of symfony-dependency-injection-proxy with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-json Version *
symfony/dependency-injection Version ^6.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 olvlvl/symfony-dependency-injection-proxy contains the following files

Loading the files please wait ....