Download the PHP package tihloh/prefab-messaging without Composer

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

Prefab Messaging

Framework-independent external outbound communication for PHP applications.

Messaging sends information outside the application. Internal bell/inbox notices belong to Prefab Notifications.

This README is the package reference documentation. Step-by-step learning examples belong in the Prefab tutorial site.

Requirements

Installation

Package scope

Prefab Messaging provides a common application-facing API for outbound delivery through replaceable channels and transports.

It is not an internal notification center, user-to-user chat system, HTTP client, webhook framework, event bus, queue worker or scheduler.

MessagingManager

MessagingManager coordinates named delivery channels.

Application code sends through a channel name instead of depending directly on provider-specific APIs.

Generic delivery

send() selects the requested channel, resolves the recipient route for that channel, executes delivery and returns a DeliveryResult.

Recipient

Recipient contains channel-specific destination routes.

A recipient can therefore expose multiple delivery destinations without forcing the manager to know the domain model of the application's users.

The application remains responsible for obtaining and validating contact information.

Message

Message represents outbound content independently from a transport.

Typical content includes:

Example:

DeliveryResult

Every delivery returns a DeliveryResult describing the outcome rather than requiring application code to interpret transport internals.

A result can carry information such as:

Information Purpose
success/failure Overall delivery state
channel Channel used for delivery
provider message ID Optional identifier returned by the external provider
error Failure information when available
metadata Provider/channel-specific result context

Applications should use the result to decide whether to display success, log failure, retry through their own job system or take another domain-specific action.

CallableChannel

CallableChannel provides a lightweight custom/test channel using a PHP callback.

It is useful for tests, development and small project-specific integrations that do not need a dedicated channel class.

ChannelInterface

Provider-specific delivery belongs behind ChannelInterface.

Conceptually:

A custom channel can implement SMS, external push, chat-provider delivery or another outbound transport while application code continues to call send().

Mail convenience API

For the common email case:

mail() expects an available mail channel and is a convenience layer over the general delivery architecture.

MailChannel

MailChannel adapts a mail transport to the common Messaging channel API.

The channel owns mail-specific message preparation while the transport owns the actual delivery mechanism.

NativeMailTransport

NativeMailTransport provides zero-dependency delivery through PHP's native mail facilities. Its actual behavior depends on the host PHP/mail-server configuration.

Use it when the environment already provides a correctly configured native mail path. For explicit SMTP configuration, use SmtpTransport.

SmtpTransport

Supported SMTP concerns include host/port configuration, authentication, STARTTLS/SSL, plain-text and HTML mail, CC/BCC, reply-to and attachments.

Do not commit SMTP credentials to source control. Load them from environment variables, secret management or another protected configuration source.

Attachments

Existing file:

In-memory content can use Attachment::fromData().

Applications should ensure attachment paths/content are authorized and appropriate for the intended recipient before sending.

Templates

The lightweight Template helper performs simple {{variable}} substitution without requiring a template engine.

Template rendering produces a normal Message; delivery remains the responsibility of the selected channel.

Lifecycle hooks

Messaging exposes synchronous delivery hooks:

Registration:

Useful callback forms include:

Hooks are appropriate for lightweight audit, metrics and integration behavior. Long-running retries and asynchronous processing belong in a queue/jobs layer.

Failure handling

Transport/provider failure is represented through the delivery result and the failed lifecycle hook where applicable.

Application policy determines what happens next:

Messaging deliberately does not become a queue or retry scheduler merely because a provider can fail.

Relationship to Prefab Notifications

An application may deliberately perform both actions for the same event. Neither package automatically triggers the other.

Relationship to Prefab Users

Messaging does not depend on a particular user model. User contact information can be converted into a Recipient by application code.

This keeps user storage independent from external delivery providers.

Relationship to Prefab Auth

Authentication workflows can use Messaging for password-reset links, one-time codes, account alerts or other external security communication.

Messaging transports the message; Auth remains responsible for authentication state, token validity and security policy.

Relationship to Prefab Files

Files can provide a stored path or application-generated file that is intentionally attached to a message. Authorization should occur before attachment creation/delivery.

Messaging does not grant access to a file merely because it can attach it.

Relationship to Prefab Logs

The sending, sent and failed hooks are natural integration points for audit logging when a project needs delivery history.

Avoid storing sensitive message bodies, credentials or tokens in audit logs unless application policy explicitly requires and protects them.

Operation tracing

Prefab's shared runtime provides developer operation tracing where a module operation has been instrumented.

The intended syntax is a separate line after the operation:

Detailed trace:

Tracing is diagnostic output rather than application presentation. Instrumentation availability depends on the operation/module version in use.

The shared runtime redacts common secret-bearing context keys such as password, secret, token and authorization fields.

Security considerations

API reference

API / component Purpose
MessagingManager::send() Send through a named channel
MessagingManager::mail() Convenience mail delivery
MessagingManager::on() Register lifecycle hooks
Message Transport-independent message content
Recipient Channel-specific recipient routes
DeliveryResult Delivery outcome
ChannelInterface Custom channel contract
CallableChannel Callback-based channel/test adapter
MailChannel Mail channel adapter
NativeMailTransport PHP-native mail transport
SmtpTransport Built-in SMTP transport
Attachment::fromPath() File-backed attachment
Attachment::fromData() In-memory attachment
Template Lightweight variable substitution

Responsibility boundary

Prefab Messaging deliberately does not own:

Concern Owner
internal bell/inbox state Prefab Notifications
user accounts Prefab Users / host application
authentication Prefab Auth
authorization Prefab Permissions / application
audit persistence Prefab Logs
file authorization/storage Prefab Files / application
queues and retries jobs/queue layer
scheduling scheduler layer
inbound webhooks HTTP/integration layer
user-to-user chat separate communication/domain component

Design principle

The core rule is: deliver outbound application messages through replaceable channels without turning Messaging into the rest of the application framework.


All versions of prefab-messaging with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
tihloh/prefab-core Version ^0.4 || ^0.5
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 tihloh/prefab-messaging contains the following files

Loading the files please wait ...