Download the PHP package utopia-php/cloudevents without Composer

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

Utopia CloudEvents

Tests Packagist Version Packagist Downloads Discord

Utopia CloudEvents is a modern PHP 8.3 implementation of the CloudEvents v1.0 specification. It provides a simple, type-safe way to work with CloudEvents in your PHP applications.

Although part of the Utopia Framework family, the library is framework-agnostic and can be used in any PHP project.

Installation

The library requires PHP 8.3+.

What are CloudEvents?

CloudEvents is a specification for describing event data in a common way. It provides a standardized format for event producers and consumers to communicate, making it easier to build event-driven architectures.

Learn more at the CloudEvents specification.

Quick Start

Creating a CloudEvent

When using the constructor, only type, source and id are required. All other attributes are optional. datacontenttype defaults to application/json; pass null to leave it unset. Arrays passed to CloudEvent::fromArray() must also carry an explicit specversion.

CloudEvent::now() returns the current time as an RFC 3339 UTC timestamp with millisecond precision (e.g., 2025-11-07T10:00:00.123Z), ready to use as the time attribute.

Converting to Array

Creating from Array

Unknown keys are preserved as extension attributes.

JSON Event Format

Serialize to and from the CloudEvents JSON event format, as used by HTTP structured mode and most message brokers:

Binary payloads (string data that is not valid UTF-8) are automatically carried in the data_base64 member.

Extension Attributes

Extension attributes carry additional metadata such as distributed tracing context. They are passed at construction time and read directly from the readonly extensions property:

Extension names must consist of lowercase letters and digits only, and values must be booleans, integers or strings. These rules are enforced at construction — an invalid extension attribute makes the constructor (and therefore fromArray() and fromJson()) throw, so a CloudEvent instance never carries invalid extensions. CloudEvent instances are immutable readonly value objects.

Validating a CloudEvent

validate() checks the event against the spec: the spec version is supported, type, source and id are non-empty, and optional attributes are non-empty when present. Extension attributes are already validated at construction.

CloudEvent Properties

The CloudEvent class supports the following context attributes according to the CloudEvents v1.0 specification:

Optional attributes are omitted from toArray() when absent, since the spec does not allow null attribute values. When present, they must not be empty.

Use Cases

Development

License

MIT


All versions of cloudevents with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 utopia-php/cloudevents contains the following files

Loading the files please wait ...