Download the PHP package dotink/affinity without Composer

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

Affinity - A Bootstrapper for PHP Projects

Affinity is a bootstrapper for PHP projects which allows you to create modular configurations and actions that can be dropped into place for added functionality without additional work.

It provides mechanisms for running bootstrap operations and logic as well as creating and accessing well organized configuration data.

Affinity is a key component of the inKWell framework, you can read more about the integration of it at:

http://inkwell.dotink.org/docs/basics/02-nano-core#Bootstrapping

Or... continue reading below for standalone use.

Basic Usage

This example shows the most basic setup of affinity. Using the native driver we can scan directories recursively for configurations or actions to load then call start() in order to execute bootstrapping.

Configuration / Action Directory Structure

The native driver assumes that your configuration and action directory structure looks like the following:

All configs and actions from default will be included no matter what and will be extended based on the environment provided to the start() call.

You can extend by multiple environments by passing a comma separated list:

This allows you to only override the necessary config data or logic for the specific environment requirements whether they be the execution mode, deployment stability, location, whatever.

The directory structure inside each environment folder is up to you, although it is suggested you use additional sub directories for namespacing purposes.

The relative path to a given config file or action is used by affinity as a means to identify the configuration or action. So, for example config/default/core.php is identified by the simple string 'core' while a file such as include/default/routes/main.php is identified by 'routes/main'.

Configurations

You can create a configuration by returning it from any PHP file located in an environment directory. For example, let's imagine adding the following to config/default/test.php:

Accessing Configuration Data

Once a config is created, you can access configuration data by using the fetch() method on the affinity engine.

The parameters for the fetch() method are the configuration id, the parameter within that configuration, and the default value if it's not found, respectively. You can access deeply nested data using a javascript style object notation for the second parameter:

Aggregate IDs

In addition to identifying a specific configuration to fetch data from, it is also possible to specify types of information which may be provided by multiple configurations using an aggregate ID. All aggregate IDs must begin with @:

In order to provide information for aggregate ID fetches, you need to pass an optional first parameter to the Affinity\Config::create() method containing a list of aggregates you provide. The data is then keyed initially under the aggregate ID within the config itself.

When fetching information from an aggregate ID, the returned array consists of one entry for every configuration file which provides that aggregate data keyed by the specific configuration id. In the case of the above mappings, this means we have to first loop over the individual configuration data, and then over the mapping themselves.

You can fetch a list of specific IDs which provide aggregate data by fetching the aggregate ID alone, without specifying a parameter:

Actions

Actions are pieces of modularized and pluggable logic which use the configuration data in order to prepare your application for running. Some of their main functions include:

Unlike configs which are just arrays of information, actions represent callable logic.

Creating an Action

Add a file to the appropriate environment and return Affinity\Action::create():

Action Ordering (Dependencies)

If you need to make sure your actions run in order, you can add an array of dependencies as an optional first argument. The below action will not run until the action identified by the core ID has run:

Context

In our first example you may have noted the addition of an array which was passed to the start() method on the engine:

This is the context. If you didn't pick up on it before, it is provided to the action operations and is also available in the configuration as normal variables. The context can be whatever you want, but is usually used to provide your application instance and dependency injector for use in configs and actions respectively.


All versions of affinity with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
dotink/flourish-core Version ^1.0.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 dotink/affinity contains the following files

Loading the files please wait ....