Download the PHP package everon/factory without Composer

On this page you can find all versions of the php package everon/factory. 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 factory

Everon Factory Component

Library to handle dependency injection and instantiation. Allows to produce code that is easy to test.

Versions

Features

How it works

Every instantiation should happen only inside of the class. Its role is similar of . It sits between Everon Factory Component and the client code that uses it, so there is no direct coupling. It's easy to implement and manage, because injection is cheap and dependency setup happens in one place.

This makes testing much easier, as everything can be easily mocked/stubbed/faked. It's ok to use operator outside of Factory methods for simple value object like classes. For example .

For a particular module or application, the method of is one of a places where you could setup your dependency tree. Or you could use Root Composition pattern and handle your whole dependency graph outside of your application.

Easy Dependency Injection

To use dependency injection, register it with and use one line trait to inject it.

For example, this will auto inject a predefined instance via setter injection into class.

Register with Dependency Container

Use method to register the dependency under name.

Define the traits and interface

Example of dependency trait, which is reused between all of the classes that use trait. The only thing to remember is that, the name of the trait should be the same, as the name under which the dependency was registered with the .

Bonus: You can also define and assign the too all classes that are being injected with instance.

Define the setter injection trait. The only requirement is that the name ends with . You can reuse already defined trait, in every class that implements LoggerAwareInterface.

Register with Factory

Use to register callback which will return instance of required FactoryWorker.

Build with FactoryWorker

To build your dependencies use the classes.

Resolve with Dependency Container

Use to receive dependency defined earlier with or . So you can pass the same instance to another class via constructor injection.

Now and will share the same instance of class.

If you don't do any work in constructors, and you shouldn't, and only require the functionality later, it would be easier to just use the as the infrastructure type dependency and just inject it via setter injection with one line. The end result is the same.

Every required class will be injected with the same instance, that was registered with the and assembled by in .

Ensures Tests Ready Code (TM)

Writing tests of classes that use for the dependency injection and instantiation removes the hassle of dealing with dependency problems since everything is so easy to mock.

Dependency Container, Factory and FactoryWorker

Instantiate new and assign it to . Use to get instance of your specific .

The best thing is, that the classes which are being instantiated with the are not aware about the at all.

It could be in separate files, obviously, split by the application type and the dependencies it needs.

An example, of using the same instance of , in every class, through out whole application, which required dependency.

What's the best way to inject dependencies?

Use constructor for dependencies that are part of what the class is doing, and use setters/getters for infrastructure type dependencies. In general, a or could be good examples of infrastructure type dependencies.

Test Driven

See tests for more examples with trait dependencies.

Example

Check Everon Criteria Builder to see how to use Everon Factory by example.


All versions of factory with dependencies

PHP Build Version
Package Version
Requires php Version ^8
everon/collection Version ^3
everon/utils Version ^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 everon/factory contains the following files

Loading the files please wait ....