Download the PHP package vcn/pipette without Composer

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

Pipette

Easily extract what you need out of JSON.

Quickstart

composer require vcn/pipette

(From the examples/ directory)

Usage

Pipette expects you to have some string of which you have the strong suspicion that it represents JSON. You can ask Pipette to parse it:

Parsing might fail, but if it succeeds you are left with a Json\Value. It represents any of the possible values it could have parsed to and allows you to then query that value:

Note that if any of those assertions are false, an exception is thrown.

Optional values

Many methods can be prefixed with an upside-down question mark (¿). This causes them to also return null in the case of null or the absence of a field in an object.

In the case of ¿field the returned Json\OptionalValue is a nullsafe variant where all subsequent calls will return null if the original field was null or absent.

Unions

If you expect your JSON to match any of more than one structures, you can use either:

See examples/huttonsrazor.php for another example.

Validation beyond the types

Pipette also provides a basic interface to hook in stronger validation methods. Currently it supports JSON Schema validations through justinrainbow/json-schema.

The idea is that you can define a JsonSchemaRepository as a dependency, that then contains references to JsonSchemas. These schemas can then validate JSON after it has been parsed, but before you use pipette to transform it into typed data.

See the examples/ directory for a typical request parser setup.

Using Pipette for JSON-like data

Under the hood Pipette simply wraps the data returned by json_decode() and performs ad-hoc validations based on your queries. That means that if you have data whose type is isomorphic to that of json_decode() you can use this library for that data as well:

What data does Pipette support? (or how does php-json represent JSON?)

Pipette's behaviour for any other type is undefined.

Careful!

Tests

Powered by phpspec. phpspec is configured to gather code coverage information. This requires xdebug or pcov. You can also disable code coverage.


All versions of pipette with dependencies

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

Loading the files please wait ....