Download the PHP package axis/axis-service-container-plugin without Composer

On this page you can find all versions of the php package axis/axis-service-container-plugin. 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 axis-service-container-plugin

AxisServiceContainerPlugin

This plugin allows to add any amount of factories configuration to symfony factories.yml using Pimple as service container.

Also it adds a rich functionality for instantiating and configuring factories.

Installation

Composer way

  1. Add axis/axis-service-container-plugin dependency to your composer.json:

  2. Enable AxisServiceContainerPlugin plugin in your ProjectConfiguration.class.php.
  3. Include lib/vendor/autoload.php file generated by Composer if it wasn't included yet. ProjectConfiguration.class.php:

Defining Services

Basic definition

You can define any services like the standard symfony factories.yml does. Assume that you have your service implemented in MyBasicServiceImplementation class:

And you want you define it using symfony context factories. So you need just to add its instantiation configuration to your factories.yml:

Now you can retrieve an instance of that class in your code:


Note: all services are stored to Pimple service container using share method. This means that each service is a shared objects instantiated only once it was requested first time.

Definition with parameters

Assume you want to instantiate a MyParamServiceImplementation class that have a parameterized constructor.

You can use parameters configuration option listing all constructor parameters in any order but preserving exact names:

The usage is the same:

Instant initialization

If your service should be instantiated (and thereby initialized) on startup you can use initialization config parameter. The only value the plugin supports is instant. Any other value is treated as undefined and meaningless.

By defining initialization: instant you tell that my_service should be instantiated just after the symfony context is created.

Including file

If your service class is not loaded automatically with symfony autoloader or any other configured autoloaders you can use file configuration option to tell symfony to include that file on context creation.

Tagging

You can mark your services with tags. This allows your to retrieve all defined services from context that have a specific tag assigned. Use tag option.

After this you can retreive all services from context using a hash-prefixed tag name:

Service Parameters

When defining services sometimes you need to define constructor parameters values. Sometimes it is not enough to use just constant values. AxisServiceContainerPlugin allows you to use advanced parameter processing.

Config value

If you want instantiate a service with a config value passed as parameter you can use config parameter processor:

It will instantiate my_service passing sfConfig::get('app_my_service_greating') value as $greating parameter.

Config value with default

Also you can use default value for config getter:

This code will instantiate my_service passing sfConfig::get('app_my_service_greating', "Wow! It supports default value!") value as $greating parameter.

Defined service

Sometimes its handy to pass any other defined service to your service constructor as parameter.

Now retrieving my_service from context service container will return a my_service service instance with my_service_transport service instance passed as $transport parameter to its constructor.

Defined services with a specific tag

Sometimes you may want to pass to service constructor a collection of services with a specific tag assigned. We can do that!

Raw value

And if you want to pass actual string value prefixed with special words and leave it unprocessed use raw prefix:

Parameters within arrays

You can use any smart parameters processing in arrays passed as parameter values. For example you can do this:

Declared services

Service container has declared services at the very beginning. They include standard symfony factories and core context entities.

Standard symfony services

All of this services can be used as initialization parameter using context:// parameter processor.

Additional plugin services

Additionally plugin appends to the service container next services:

Known issues

What's new

1.1 - Output Service container generated config cache code before sfFactoryConfigHandler code.


All versions of axis-service-container-plugin with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
composer/installers Version *
pimple/pimple Version 1.*
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 axis/axis-service-container-plugin contains the following files

Loading the files please wait ....