Download the PHP package polyprism/runtime without Composer

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

polyprism/runtime

Runtime helpers for PolyPrism's PHP domain-class emitter. Provides the Coerce and Normalise utilities that generated property-hook setters call into — and which you can also use directly in hand-written PHP for boundary-input normalisation.

Primarily designed to back @polyprism/php-domain-class's generated code. The other PHP generators (@polyprism/php-class, @polyprism/php-readonly) emit code with zero runtime dependencies — they don't need this package.

Requirements

If you're using @polyprism/php-domain-class-generated code: that generated code uses PHP 8.4 property hooks (public int $x { set(...) { ... } }) and so requires PHP 8.4+ to run. But the runtime itself is broadly compatible — meaning you can composer require polyprism/runtime from a Magento 2.4+, Symfony 6+, or Laravel 10+ project today and use Coerce::int(...) / Normalise::apply(...) directly in hand-written classes, even if you can't yet adopt the generator's output.

Install

The PolyPrism PHP domain-class generator emits use Polyprism\Runtime\Coerce; and use Polyprism\Runtime\Normalise; at the top of each model file — Composer's PSR-4 autoloader wires them up. For hand-written usage, import the same way.

What's in the box

Polyprism\Runtime\Coerce

Static methods that mirror @polyprism/runtime's coerce primitives. Each accepts a widened input type, returns the canonical PHP type, and throws \TypeError with the field path on invalid input.

Method Returns
Coerce::int(int\|string $v, string $path) int
Coerce::float(float\|int\|string $v, string $p) float
Coerce::bigint(int\|string $v, string $path) int (64-bit signed)
Coerce::date(...mixed $v, string $path) \DateTimeImmutable
Coerce::decimal(...mixed $v, string $path) string

Notes:

Error messages line up with the JS runtime's format:

Polyprism\Runtime\Normalise

Ops are class constants (use these in generated code, not raw strings):

Ops are applied in declared order. apply ignores NULL_EMPTY_TO_NULL (it's only meaningful on the nullable path).

Versioning

polyprism/runtime (Composer / Packagist) and @polyprism/runtime (npm) are versioned independently — they target different language runtimes and don't share code. The PHP package's floor is PHP 8.1 (broad Magento/Symfony/Laravel compatibility) and will float upward only when a new PHP feature meaningfully improves the runtime's contract. The npm runtime targets Node 22+ and follows the same float-the-floor policy.

Hand-written usage example

This is the pattern Magento module authors / Symfony service constructors / Laravel form-request handlers can adopt on PHP 8.1 today, without waiting for property-hook adoption to land in their framework.

License

MIT


All versions of runtime with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 polyprism/runtime contains the following files

Loading the files please wait ...