Download the PHP package danharper/laravel-jsonx without Composer

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

JSONx for Laravel

Latest Stable Version License

Add XML support to your JSON API just by adding this one middleware. All incoming XML requests are converted to JSON. All outgoing JSON responses are converted to XML.

Requests just need to use the Accept: application/xml header to receive the response as XML. And if they're sending in XML, they just need to use the Content-Type: application/xml header too.

It does this using IBM's standard for representing JSON as XML: JSONx.

This library is just a small wrapper around danharper/jsonx. If you're not using Laravel, or want something based around standard PSR-7 messages, check out danharper/psr7-jsonx.

Installation

Register the middleware within $routeMiddleware in app/Http/Kernel:

And simply add the jsonx middleware to your API routes.

Example

Once the middleware's registered, use it like so:

Make a JSON request, e.g. using the Accept: application/json header and in response you'll get (as Laravel provides by default):

But make an XML request using the Accept: application/xml header and you'll get back JSONx:

Additionally, incoming XML data (formatted as JSONx) will be seamlessly converted to JSON.

So for example, these two are equivalent (assuming they're sent with Content-Type: application/json and Content-Type: application/xml headers respectively):

And with a handler:

When the response is asked for as JSON (default) as Accept: application/json or XML as Accept: application/xml, the response will be:


All versions of laravel-jsonx with dependencies

PHP Build Version
Package Version
Requires danharper/jsonx Version ^0.1.0
illuminate/http Version >=4.1.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 danharper/laravel-jsonx contains the following files

Loading the files please wait ....