Download the PHP package ionews/light-service-php without Composer

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

LightService PHP

Latest Stable Version License Build Status Coverage Status Dependency Status HHVM Status

Small piece of software intended to enforce SRP on PHP apps, thought to be "light" and not use any dependencies. Heavily based on the ideas proposed by two ruby gems:

Concept

Each action should have a single responsibility that must be implemented in the perform method. An action can access databases, send emails, call services and etc. When an action is executed, it receives a context which can be read and modified.

To perform more complex operations you must use an organizer chaining multiple actions, which will share the same context during execution. In fact, an organizer is nothing more than an action with a specific implementation, meaning that an action and an organizer share the very same interface. This is useful so you can include an organizer as an action inside another organizer.

Action examples:

Organizer example:

Call example (from a MVC controller):

Keep in mind that you shouldn't use this approach everywhere in your app, but only in the really complex parts of it.

Fail, Halt and Exceptions

An action may fail, meaning that it couldn't achieve its goal. To make an action fail just call the fail method (optionally passing a message).

If the action is executing inside an organizer and fails, it will prevent the execution of the subsequents actions. If an action implements a rollback method, it will be called after a subsequent action fails. Example: if EmailUserWithPassword fails to send an e-mail to the user, we could implement an rollback method in the UpdateUserPassword to undo the update. Inside the rollback method you can access the context in the same way as in perform.

You shouldn't re-implement the rollback method of an organizer, unless you really know what you're doing.

It's possible to stop the execution chain without fail: using halt. Basically it will prevent any subsequent actions of execute, but the result remains a success. You can test if an action/organizer was halted using the halted method.

All exceptions that occur when performing an action are caught automatically and passed to the caught method. By default, actions re-throw then, on the other hand, organizers first call the rollback method before re-throwing. This is done so all performed actions are rolled back before the exception propagation. You can change this behaviour re-implementing the caught method.

Before and After

A before method can be implemented if you need to do any setup pre-execution. If the fail method is called inside the before, perform will never be called. In the same way, an after method can be implemented so you can do any cleanup, but keep in mind that if before or perform fails it will never be called.

Expects and Promises

Expectations and promises can be defined for each action. If an action has a set of expectations, it will automatically fails if these aren't met.

Similarly, an action will fail if a set of promises are defined and these are not present in the context at the end of execution.

This feature is particularly useful so you can explicitly define the interface between the actions.

Iterator Action

It's an action that will be performed over an array.

Requirements

Installation and Usage

Contributing

You know the drill!

License

Released under GPLv2


All versions of light-service-php with dependencies

PHP Build Version
Package Version
No informations.
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 ionews/light-service-php contains the following files

Loading the files please wait ....