Download the PHP package alexistm/simple-json-php without Composer

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

Simple JSON for PHP Build Status

Introduction

Simple JSON for PHP simplify the json_encode function. Instead of creating a Stdclass and then json_encode it, send, headers and echo the json, you can simply create the object and use $json->send();.

Pros:

Cons:

Usage

Sending the json you want

The constructor allow you to send JSON, JSONP with callback or in a variable.

simply a JSON

Callback JSONP

Varibale JSONP

Options

Options are the default options passed to json_encode.

Will output:

For example:

HTML/JS part example

This library give you a strong JSON API capabilities. But an API is useless if you do not have the front-end. Here are some examples.

Callback with a raw json using JQuery.ajax

Callback with a raw json using JQuery.getJSON

Legacy javascript for dynamic loading for JSONP

Validating JSON

To validate the JSON, you can grab back the JSON string via the make() method then pass it through an other library.

Knows dumb errors

Contribute

To contribute, just contact me! The first fork will be awesome for me!

NOTE:

The reason it comes in version 4 which changes a bit the API is the speed. I as wondering how fast it was to use the library and after some tests, it shows it was 6 times slower than the native function. Therefore, for my own sake, it has to be reworked.

It now as fast as the native json_encode, without having to think at all.

Licence

This work is under MIT licence. Short version: You have to add Alexis Paques in the credits but you can use it for closed-source commercial project.

What next ?

The next step is obviously to add routes, which is needed to make a powerful API.

References

Informations: https://en.wikipedia.org/wiki/JSONP

Validator: http://json.parser.online.fr

ECMA-404: http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf

json_encode: https://php.net/manual/fr/function.json-encode.php

Comparaison of JSON PHP libs: http://gggeek.altervista.org/sw/article_20061113.html

JSON API Standard: http://jsonapi.org/

Credits

Alexis PAQUES (@AlexisTM)


All versions of simple-json-php with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.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 alexistm/simple-json-php contains the following files

Loading the files please wait ....