Download the PHP package germania-kg/order-dispatcher without Composer

On this page you can find all versions of the php package germania-kg/order-dispatcher. 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 order-dispatcher


Germania KG · OrderDispatcher

Sourcing that stuff out…

Installation

Classes and interfaces

Working with orders

OrderInterface

public function getCustomerData() : array;
public function getItems() : iterable;

OrderFactoryInterface

OrderFactoryAbstract

This abstract class implements the Item factory interceptors defined in OrderFactoryInterface and uses the ValidatorTrait.

ArrayOrderFactory

Creates an Order instance from an array, typically from user input.

The ArrayOrderFactory extends OrderFactoryAbstract and implements the OrderFactoryInterface.

The constructor accepts an ItemFactoryInterface, the order items array key, and optionally a PSR-3 LoggerInterface.

Usage with above setup:

OrderHandlerController

This controller class accepts user input from the ServerRequest body, creates an Order object underway and delegates it to the given handler.

Its constructor accepts an OrderFactoryInterface instance, an OrderHandlerInterface instance, and optionally a PSR-3 LoggerInterface.

Given a ServerRequest and a Response object, invoke the controller like this:

Response status codes
Status code
400 When OrderFactoryExceptionInterface occured
500 When OrderHandlerExceptionInterface occured
500 any other Throwable
Response headers

In case of an error, the response object will have a X-Order-Dispatch-Message header with the class name of the thrown Exception:


Working with order items

Order items are the things one can order.

Item class and ItemInterface

The ItemInterface extends \ArrayAccess.

The Item class extends \ArrayObject and implements ItemInterface.

ItemFactoryInterface

SimpleItemFactory

Create an “order item” array based on any array data. Extends ItemFactoryAbstract and implements ItemFactoryInterface.

ContainerItemFactory

Use this to restrict order items to only items from a PSR-11 Psr\Container\ContainerInterface. The array field name with which the item shall be retrieved is required, and the constructor optionally accepts a PSR-3 Logger.

Extends ItemFactoryAbstract and implements ItemFactoryInterface.

When an item is not available, a ItemNotAvailableException will be thrown.

ValidatorItemFactoryDecorator

This decorator accepts any ItemFactoryInterface and a ValidatorInterface to validate the order item data.


Render orders

Renderers are used to create a string representation from an order object, typically for emails.

RendererInterface

Renderers accept a template string and a context variables array. In case of errors, Germania\OrderDispatcher\Exceptions\RendererExceptionInterface must be thrown.

TwigRenderer

The TwigRenderer implements the RendererInterface. Its constructor accepts a Twig environment object, and optionally an array with default context variables.


Work with orders

OrderHandlerInterface

SwiftMailerOrderHandler

The SwiftMailerOrderHandler implements the OrderHandlerInterface. Its constructor accepts a SwiftMailer instance, a mail configuration array, and a RendererInterface instance.

Typically, you will use the TwigRenderer for RendererInterface.

The mail configuration array must contain a to, from, template,and a subject element. The subject may have field variables in curly braces which are interpolated from the handle method context.

Subject and template given in mail configuration array may be overridden by mailSubject or mailTemplate entry in the context array.

The renderer will be passed the handler context with additional customer, orderItems, and datetimeNow information.

OrderHandlerChain

Use this handler to mangle an order through multiple handlers.

Validators

ValidatorInterface

Validates user input and returns cleaned data. Usually PHP's filter_var_array will be used.

When writing your own implementation, missing fields should be added and set to null, any additional content should be merged back.

ValidatorTrait

Interceptors for ValidatorInterface.

FilterValidator

This validator checks user input with PHP's filter_var_array.

The FilterValidator Implements ValidatorInterface.

SkuQtyItemValidator

This is a predefined Validator which checks user input for sku and quantity elements. It works just like FilterValidator:

Exceptions

The SkuQtyItemValidator Implements ValidatorInterface.

Exceptions

Interface sub interface Class parent
OrderFactoryExceptionInterface ItemNotAvailableException UnexpectedValueException
OrderFactoryExceptionInterface RequiredUserDataMissingException UnexpectedValueException
OrderFactoryExceptionInterface NoArticlesOrderedException Exception
OrderHandlerExceptionInterface OrderHandlerRuntimeException RuntimeException
OrderHandlerExceptionInterface ItemExceptionInterface ItemInvalidUserDataException UnexpectedValueException
OrderHandlerExceptionInterface ItemExceptionInterface ItemNotOrderedException Exception
RendererExceptionInterface RendererRuntimeException RuntimeException
ValidatorExceptionInterface ValidatorUnexpectedValueException UnexpectedValueException

All versions of order-dispatcher with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1|^8.0
psr/http-message Version ^1.0
psr/log Version ^1.1
psr/container Version ^1.0|^2.0
twig/twig Version ^3.0
swiftmailer/swiftmailer Version ^6.2
nyholm/psr7 Version ^1.3
germania-kg/responder Version ^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 germania-kg/order-dispatcher contains the following files

Loading the files please wait ....