Download the PHP package marcosh/effector without Composer

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

Effector

Build Status Latest Stable Version Code Climate Coverage Status Code Quality Scrutinizer Code Quality

A Php library to write effect aware code.

In this library you will find a collection of classes, each one representing a single (side) effects. This allows you to write completely functional code treating effects as data, and delegating their execution to another component of your application.

You could find more details about the ideas beyond this approach here.

Install

Add this library to your dependencies using Composer with the command

Usage

Every class contained in the src/Effect folder represents a single (side) effect. For example Marcosh\Effector\Effect\Echo_ represents the operation of echoing a string, or Marcosh\Effector\Effect|FileGetContents represents the operation of reading a file.

You can create a new instance of an effects simply with

Pay attention to the fact that nothing will actually happen at this moment (except for the creation of the new instance of the class).

To actually perform the effect described by the class, you will need to invoke it

This will actually perform the effect and echo the string passed as argument.

Compose effects

Representing effects as data is useful since you could pass them around, as input parameters or as return values of functions. Still if you had not the ability to create more complex effects from simple ones, they could be quite limiting.

Luckily, composing effects is pretty easy. To do that you could use the Marcosh\Effector\Compose class. This will receive several effects and pieces of logic and combine them in a single complex effect.

For example, if you have an effect that receives an HTTP request and an effect that emits an HTTP response, you could compose them to create a web application. This could be done as follows:

When you compose effects and pieces of logic, you have to be careful the each piece should return the input for the next one.

Examples

Several examples of possible usages and functionalities are provided in the example folder.

Run an example using

or, if you are using Docker to obtain a PHP 7.1 environment, you could use

The examples contained in Http.php and in SerializeEffect.php are web application, so you need a web server to try them. The easiest option is to use the built in PHP web server with

or, if you are using Docker,

and then navigate to localhost:8000 to see it working.


All versions of effector with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
zendframework/zend-diactoros Version ^1.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 marcosh/effector contains the following files

Loading the files please wait ....