Download the PHP package kutny/autowiring-bundle without Composer

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

Symfony autowiring bundle

A simple library that provides autowiring for the Symfony2 Dependency Injection (DI) container.

This bundle supports constructor autowiring only, see http://springindepth.com/book/in-depth-ioc-autowiring.html for description.

Like this Bundle? Send me your feedback or just "thank you" message to [email protected].

Installation

1) Install via composer:

composer require kutny/autowiring-bundle

2) Add KutnyAutowiringBundle to your application kernel

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Kutny\AutowiringBundle\KutnyAutowiringBundle(),
        // ...
    );
}

Configuration

In most cases this bundle does not require any configuration. However if your app fails to start after installing this bundle giving you Kutny\AutowiringBundle\Compiler\CannotResolveParameterException, you may need to remove some services from autowiring. See example bellow:

Example 1:

You are receiving Kutny\AutowiringBundle\Compiler\CannotResolveParameterException with message like "Class Thrace\FormBundle\Form\Type\Select2Type (service thrace_form.form.type.select2), parameter $widget".

The problem is that Thrace\FormBundle\Form\Type\Select2Type service definition does not contain explicit $widget argument definition. It is very likely that the Thrace\FormBundle developer just forgot to define the $widget argument. KutnyAutowiringBundle expects all services to have all arguments defined (or have default values). As a result we have to disable autowiring for the thrace_form.form.type.select2 service by adding it (as a regular expression) among ignored_services:


kutny_autowiring:
    ignored_services: ['thrace_form\.form\.type\.select2']

If you run into problems with more services from the Thrace\FormBundle bundle (thrace_form.form.type.select2, thrace_form.form.type.recaptcha, ...), you can easily add the whole "service namespace" to ignored_services using the following reqular expression:


kutny_autowiring:
    ignored_services: ['thrace_form\.form\.type.*']

Example 1: Simple controller autowiring

Sample controller with service autowiring (controller itself is also defined as service):

namespace Acme\DemoBundle\Controller;

use Acme\DemoBundle\Facade\ProductsFacade;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

/**
 * @Route(service="controller.products_controller")
 */
class ProductsController
{

  private $productsFacade;

    public function __construct(ProductsFacade $productsFacade)
    {
        $this->productsFacade = $productsFacade;
    }

    /**
     * @Route("/", name="route.products")
     * @Template()
     */
    public function productsAction()
    {
        return array(
            'products' => $this->productsFacade->getProducts()
        );
    }

}

Services configuration in app/config.yml:


services:
    controller.products_controller:
        class: Acme\DemoBundle\Controller\ProductsController

    facade.products_facade:
        class: Acme\DemoBundle\Facade\ProductsFacade

Example 2: Partial manual wiring

In the following example, I've added:

Services config:


services:
    controller.products_controller:
        class: Acme\DemoBundle\Controller\ProductsController
        arguments: [10]

    facade.products_facade:
        class: Acme\DemoBundle\Facade\ProductsFacade

    repository.products_repository:
        class: Acme\DemoBundle\Repository\ProductsRepository
        arguments: [@doctrine.orm.default_entity_manager]

Autowiring bundle will autowire some services by their type for the Symfony DI Container to work with the following configuration:


services:
    controller.products_controller:
        class: Acme\DemoBundle\Controller\ProductsController
        arguments: [10, @facade.products_facade]

    facade.products_facade:
        class: Acme\DemoBundle\Facade\ProductsFacade
        arguments: [@repository.products_repository]

    repository.products_repository:
        class: Acme\DemoBundle\Repository\ProductsRepository
        arguments: [@doctrine.orm.default_entity_manager]

License

https://github.com/kutny/autowiring-bundle/blob/master/LICENSE

Bitdeli Badge


All versions of autowiring-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.2
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 kutny/autowiring-bundle contains the following files

Loading the files please wait ....