Download the PHP package mtymek/blast-reflection-factory without Composer

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

Blast\ReflectionFactory

Build Status

Universal auto-wiring factory for Laminas ServiceManager.

Introduction

Writing factories for Laminas ServiceManager can be boring, repeatable task. Typical service will consume one or more dependencies using constructor injection:

This is how factory is going to look like:

In typical application, you will end up with multiple factories that simply pull some services and create new object. ReflectionFactory can take care of this use case for you - it uses Reflection to scan parameter types in constructor and instantiates new object based on this information.

Installation

Install this package using Composer:

Usage

After installing this package, all you have to do is to tell ServiceManager to use ReflectionFactory to create your services.

For Laminas Mezzio application, configuration can look like this:

Caching

Auto-wiring is expensive operation, so ReflectionFactory allows to store the result on disk to be reused later:

If you are using Zend Expressive Skeleton Application, then config/container.php would be a good place to enable this cache.

Warming-up cache

Cache file is automatically updated when a service is pulled from the container for the first time. This can lead to race conditions when your application is under heavy load. In order to avoid it, cache should be warmed up during deployment phase. The easiest way to do it is to go through all configured factories, pulling every service from the container.

Example script for applications based on Mezzio Skeleton:

Limitations

ReflectionFactory is only meant to be used in typical scenario, when all dependencies are injected using constructor. All of them must be type-hinted - otherwise ReflectionFactory won't be able to resolve them. Despite this limitation, this library should still let you reduce number of factories you have to write.

What is not supported (and won't be):


All versions of blast-reflection-factory with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ~8.0 || ~8.1
laminas/laminas-servicemanager Version ^3.3
webimpress/safe-writer Version ^2.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 mtymek/blast-reflection-factory contains the following files

Loading the files please wait ....