• ActiveWAFL 2727 API Reference Documentation
  • Search
  • Version

DblEj \ Communication

The Communication namespace.

Contains high-level interfaces, concrete implementations, and utility classes for both the client and server side that are related to the communication of data between computers.

Notable functionality that the implementations provide include: HTTP client (Javascript (Ajax) & PHP), REST client, FTP client, Request Routing,

 
DblEj\Communication

Classes

ApiRequestHandler Abstract
EmailUtil Static

EmailUtil is an email client utility class.

FtpUtil Static

FtpUtil is an FTP client utility class.

JsonUtil Static

A utility class for encoding/decoding objects to/from JSON.

The methods in this class can be used to serialize objects that have private members exposed via public property accessors.

Instances of counterpart-compliant classes are encoded with meta-data that allow them to be decoded as an instance of the correct class.

Likewise, JSON strings with encoded counterpart meta-data will be decoded as an instance of the correct counterpart-compliant class.

This allows for cross-platform transmission of serialized data where strong-typed data's types are preserved.

For example: Let's say there is a PHP class called "Employee" that has properties that describe an employee and methods that act on an employee record.

Let's say there is also a Javascript class called "Employee" that has the same properties, and some methods of it's own that perform client-side actions on the employee record.

Normally, if you serialize an instance of the PHP Employee class and send it to Javascript (via an Ajax response, for example), it will be deserialized on the client-side as a generic Javascript Object. It's properties will be whatever public variables that were exposed by the PHP object (which usually is none, in DblEj applications). It will not have any of the methods that the Employee class has.

With DblEj, if you serialize an instance of the PHP Employee counterpart-compliant class and send it to Javascript (via an Ajax response, for example), it will be deserialized on the client-side as an instance of the Javascript Employee class. It's properties will be whatever properties the javascript Employee class has defined, and where those properties match public properties that were exposed by the PHP object via accessors (which usually all of them, in DblEj applications), their values will be the same as well. Because it is an actual Employee object, and not a generic Object, it will have all of it's normal methods.

Likewise, an instance of a counterpart-compliant Javascript Employee class on the client-side that is encoded using the methods in this class can be decoded on the server-side as an instance of the PHP Employee class.

Request

A simple request with a string for it's contents.

Response

Represents a response to a request.

Route

Represents a route to a destination. The type and value of the destination is not constrained, other than that in order for it to ever be reached, it (the destination) must be reachable. The destination doesn't necessarily need to be reachable now, but it needs to be reachable at some point in it's lifetime, or it is not a valid destination. A stated destination that is never reachable is therefore said to be a two-faced non-destination. The only sure way to prove that a destination is reachable is that it is reached at some point in it's lifetime. Otherwise you're just a two-faced non-destination sensation. However, a destination can only be reached if it's reachable!

Interfaces

IConnectedService
IJsonInterfacable

Exposes methods called by the JSON serializer when serializing an object.

Makes instances of a class serializable by the DblEj JSON serializer (which is used for Ajax/Api communications).

IRequest

Represents any request that solicits a response. The data and format of the request is determined by the implementation.

IRequestHandler

A RequestHandler's job is to receive a request and return an appropriate response.

IResponse

Represents a response to any type of request.

IRoute

An IRoute defines a destination, and provides a mechanism for sending information to that destination. A destination can be any recipient of information, via any interface. It is a route's job to know how to talk to the destination.

IRouter

A Router's job is to find a suitable route for a given request. A router should act as though it is part of a router chain in a chain-of-responsibility type of implementation.

ISender
IService
ISmsSender

ITransactionalEmail

ITravelDestination

Exceptions

AccessDeniedException

Thrown when there is an unexpected situation during communication.

CommunicationException

An exception for communication related operations.

Exception

Thrown when there is an unexpected situation during communication.

IncompleteUrlException

Thrown when an incomplete URL is used in an operation or passed as an argument, except where an incomplete URL is expected.

Child Namespaces

Ajax

Create and respond to Ajax requests on the client (JS) and server (PHP) side. NOTE: The name "Ajax" is a misnomer since the default implementation is actually JSON over HTTP.

Http

PHP base-classes for and full implementations of HTTP clients, as well as classes used for storing HTTP-related data such as headers, requests, and responses. There are also some related exception classes.

Tcp
WebSocket