Download the PHP package facile-it/php-codec without Composer

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

PHP-codec

PHP-codec is a partial porting of io-ts in PHP.

Minimum PHP Version

CI Static analysis codecov Join the chat at https://gitter.im/php-codec/community

Install it now. It only requires PHP >= 7.4.

composer require facile-it/php-codec

Disclaimer

This project is under active development: it's unstable and still poorly documented. The API is likely to change several times, and it won't be ready for production soon.

The project follows semantic versioning.

Introduction

This project is a partial porting of the fantastic io-ts library for Typescript. Everything rounds about the concept of decoder, encoder and codec.

Decoders are capable of transform values from one type to another one. This transformation may fail.

Encoders do a similar transformation but between types such that it cannot fail.

Codecs are a combination of a decoder and an encoder, putting together their features.

I recommend reading the The Idea section from the documentation of io-ts. It starts with a beautiful description of what codecs are.

A value of type Type<A, O, I> (called "codec") is the run time representation of the static type A.

Getting started

composer require facile-it/php-codec

Decoders

Decoders are objects with decoding capabilities. A decoder of type Decoder<I, A> takes an input of type I and builds a result of type Validation<A>.

The class Facile\PhpCodec\Decoders provides factory methods for built-in decoders and combinators.

How to use decoders

Dealing with the validation result

We can use Validation::fold to destruct the validation result while providing a valid result in any case.

You can use the path reporter to build well-formatted error messages for failures.

Examples

Take a look to the examples folder.

Reporters

Reporters do create reports from Validation objects. Generally speaking, reporters are objects that implement the Reporter<T> interface, given T the type of the report that the generate.

One interesting group of reporters is the validation error reporters group. They implements Reporter<list<string>>. Thus, given a Validation object, they generate a list of error messages for each validation error.

PHP-Codec comes with two error reporters:


All versions of php-codec with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 | ^8.0
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 facile-it/php-codec contains the following files

Loading the files please wait ....