Download the PHP package kilahm/ioc-factory-container without Composer

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

IOC Factory Container

Join the chat at https://gitter.im/kilahm/IOCFactoryContainer Build Status HHVM Status

Compile a type safe IOC Container from user defined attributes.

Use

This library includes an executable that will scan your project directory for factories then construct a valid hack file that aliases all your factories as public instance methods of a single class. Your factory methods must accept only a single parameter which is the factory container.

The factory container should only be instantiated once in your application's bootstrap. You should then be able to use the container to instantiate your application class and run it.

Mark factories with attributes

Here is an example class with its factory function marked.

The attribute name is provides and requires one paramter, which is an alias for the factory method. The above definition would compile to:

Note that you are able to retrieve the same instance by calling $factory->getMyA() any number of times, but calling $factory->makeMyA() will always return a new instance.

Run the factory container compiler

After defining some factory methods, run the findfactories executable, which can be found in your vendor/bin directory. The executable takes any number of arguments which will be interpreted as base directories to scan. The executable will also accept any number of --exclude="..." long options which is interpreted as a directory to ignore.

The command above (if run from your project directory) will recursively scan the src/ and other/path/ directories, except for the src/ignore, other/path/to/ignore directories and their children. The resulting factory container file will be created in the project root and will be named FactoryContainer.php. You may optionally provide the path to install FactoryContainer.php by using the --install-path="dir/to/put/file" option.

Namespaces

You may use namespaces and use as normal, and the compiler will expand the class names to include their namespace.

The files above would compile to container methods shown below.

None of the examples above were particularly useful factories. This tool would be more useful when a particular class has many dependencies and you wish to encapsulate instantiation inside of a single method.


All versions of ioc-factory-container with dependencies

PHP Build Version
Package Version
Requires hhvm Version >=3.5
hackpack/hack-class-scanner Version 1.*
kilahm/hack-clio Version ~1.1.0
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 kilahm/ioc-factory-container contains the following files

Loading the files please wait ....