Download the PHP package devlop/json without Composer

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

Latest Stable Version License

Json

JSON wrapper that provide better developer experience than the native json_encode and json_decode.

Installation

Differences to json_encode / json_decode

Usage

Both encode and decode are static methods and have the same order of arguments: first the input, followed by int $flags and lastly int $depth.

Encoding

The encode method is a wrapper for the native json_encode method.

Signature: public static function encode(array|object $value, int $flags = 0, int $depth = 512) : string

Encoding (Pretty Print)

The pretty method is a convenience method to get pretty formatted output without having to manually specify the JSON_PRETTY_PRINT flag.

It has the same signature as encode().

Decoding

The decode method is a wrapper for the native json_decode method.

Signature: public static function decode(string $json, int $flags = 0, int $depth = 512) : array|object

Decoding (Associative)

The decodeAssoc method is a convenience method to decode but force all objects to associative arrays without having to manually specify the JSON_OBJECT_AS_ARRAY flag.

It has the same signature as decode().

Error handling

Any time an error occurs the native JsonException will be thrown.

Supported types

My belief is that the most common usage of JSON in PHP is to store a JSON representation of arrays or objects. It is true that a single string, integer, boolean or even a single null value is a valid JSON document, but if you are as me and only using JSON for arrays or objects then it's just easier to treat anything else as invalid data and throw an exception, this removes some of the need to check the type after decoding.

depth argument and NO_FLAGS

If you want to access the $depth argument without adding any additional flags, you must supply the default value 0 for the $flags argument, but to make the experiance more clearer you can use the constant Json::NO_FLAGS instead.


All versions of json with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^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 devlop/json contains the following files

Loading the files please wait ....