Download the PHP package dakujem/strata74 without Composer

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

✋ Please note

This is a backport of the original package dakujem/strata, for PHP 7.4 only.

Based on v1.0 release of the PHP 8 version.

After updating to PHP 8, just change the requirement to dakujem/strata.
Chances are, you need not do anything else.
If your classes directly implement strata interfaces, you will only need to update type hints of implemented methods (pin, replaceContext, pass, explain, tag and convey).

The PHP 8 version has improved key handling (supports integer keys, aligned with PHP array key handling) and full test coverage.

Strata

Contracts and implementations for layered exception handling mechanisms.

TL;DR

Native PHP exceptions allow to carry a string message and an integer code.

👉 That's not enough. 👈

Embrace context-enabled exceptions.

Context-enabled exceptions

HTTP client error example:

Internal logic fault:

The meta-data can be used by server-side error handlers to report detailed data.

The client-facing data can be used by client apps and displayed to end users or processed programmatically.
This is especially useful for API+client app architecture (JS widgets, PWAs, mobile apps, etc.).

Processing context using error handlers

Typically, your apps will have a global error handling mechanism in place, be it a try-catch block in your bootstrap, error handling middleware or a native error handler.

Something along these lines:

In Laravel, for example, it's usually the App\Exceptions\Handler class that handles the exceptions.
In Slim, middleware is used for error handling.
Symfony will also catch all exceptions and errors, and it is possible to customize the handling logic.

All these rely on developers to come up with specific exceptions that carry specific context, like Guzzle's RequestException carries HTTP request and response.
And that's fine. By all means, do create specific exceptions for specific purposes.
Strata will help enable context support by implementing a single interface (SupportsContextStrata) and using a single trait (ContextStrata).

There's also times when one does not need specific exceptions, but still wishes to pass contextual data to global error handlers.
Strata provide exceptions for common HTTP responses.

To add context for reporting or logging or to add information targeted at front-end consumers, strata provide both the interfaces and the implementations.

Examples

Example of an exception handler in Laravel (JSON API):

Example of processing the internal context for improved Sentry reports:

Notable contracts for API design

Contracts for automatic error handling, especially useful for HTTP APIs:

Common HTTP 4xx exceptions

This package provides exceptions for common 4xx HTTP status responses:

See the HTTP status reference for more information.

Build your own

The strata contracts and traits allow and encourage developers to come up with their own exceptions for specific use-cases easily.

If only selected mechanisms are needed, use the table below to pick specific interfaces and traits:

Method Mechanism Implement interface Use trait
pin generic internal metadata "pinning" SupportsInternalContext SupportInternalContext
explain human-readable details for developers SupportsInternalExmplanation SupportInternalExmplanation
tag machine-processable tags SupportsTagging SupportTagging
pass public data for clients SupportsPublicContext SupportPublicContext
convey coherent error details for clients SupportsPublicConveying SupportPublicConveying
pin, tag, explain internal metadata only SupportsInternals SupportInternals
all of them all of them SupportsContextStrata ContextStrata

To provide throwables with HTTP capabilities, implement the following trivial interfaces:


All versions of strata74 with dependencies

PHP Build Version
Package Version
Requires php Version 7.4.*
ext-json Version *
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 dakujem/strata74 contains the following files

Loading the files please wait ....