Download the PHP package milpa/mercure without Composer

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

Milpa

# Milpa Mercure > The **Mercure hub publisher** for the Milpa PHP framework, with **zero package dependencies**. One class, `MercureService`, mints self-signed HS256 JWTs by hand and pushes real-time updates to a [Mercure](https://mercure.rocks/) hub over `curl_*` directly — no HTTP client abstraction, no `milpa/core` at runtime. [![CI](https://github.com/getmilpa/mercure/actions/workflows/ci.yml/badge.svg)](https://github.com/getmilpa/mercure/actions/workflows/ci.yml) [![Packagist](https://img.shields.io/packagist/v/milpa/mercure.svg)](https://packagist.org/packages/milpa/mercure) [![PHP](https://img.shields.io/badge/php-%E2%89%A5%208.3-777bb4.svg)](https://www.php.net/) [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE) [![Docs](https://img.shields.io/badge/docs-API%20reference-blue.svg)](https://getmilpa.github.io/mercure/) `milpa/mercure` is the smallest possible seam onto a [Mercure hub](https://mercure.rocks/): sign a publisher JWT, `POST` a topic + JSON payload to the hub's `/.well-known/mercure` endpoint, and mint short-lived subscriber JWTs for the browser's `EventSource` connection. **No ORM, no event dispatcher, no framework coupling** — construct it with four strings and call `publish()`. ## Install ## Quick example The browser then opens `new EventSource(publicUrl + '?topic=...', { withCredentials: true })` with `$jwt` set as the `mercureAuthorization` cookie — standard Mercure subscribe flow, nothing Milpa-specific about it. ## What it does — and doesn't - **`publish(string $topic, array $data)`** — signs a 1-minute publisher JWT scoped to `$topic`, form-encodes `topic` + `json_encode($data)`, and `POST`s it to `hubUrl` with `Authorization: Bearer `. A `curl_init()` failure, a `curl_exec()` failure, or an HTTP status `>= 400` all throw `RuntimeException` — `publish()` never fails silently. - **`generateSubscriberJwt(array $topics)`** — a 5-minute HS256 JWT whose payload is `{"mercure":{"subscribe":$topics},"exp":...}`, signed with `subscriberKey`. This is the token a browser presents to subscribe; it grants no publish access. - **`getPublicUrl()`** — returns the `publicUrl` given to the constructor, unmodified. Kept separate from `hubUrl` because the two are commonly different: the server publishes to an internal/Docker-network hostname, while the browser subscribes through a public one. Both JWTs are HS256, hand-assembled from `header.payload.signature` with `hash_hmac()` + base64url — no JWT library dependency. There is no retry, no queue, and no HTTP client abstraction to inject: `publish()` talks to `curl_*` directly, by design (see [Requirements](#requirements)). ## Requirements - PHP **≥ 8.3** with the **cURL extension** enabled (`ext-curl`) - Nothing else — `milpa/mercure` has no package dependencies, Milpa or otherwise ## Documentation **Full API reference: [getmilpa.github.io/mercure](https://getmilpa.github.io/mercure/)** — generated straight from the source DocBlocks and dressed with the Milpa design system. ## Contributing Contributions are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md). Please report security issues via [SECURITY.md](SECURITY.md), and note that this project follows a [Code of Conduct](CODE_OF_CONDUCT.md). ## License [Apache-2.0](LICENSE) © Rodrigo Vicente - TeamX Agency. --- Milpa is designed, built, and maintained by **[Rodrigo Vicente - TeamX Agency](https://teamx.agency/?utm_source=github&utm_medium=readme&utm_campaign=milpa&utm_content=mercure)**.

All versions of mercure 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 milpa/mercure contains the following files

Loading the files please wait ...