Download the PHP package peterdkc/parser without Composer

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

Note: This package is a fork and may / may not be maintained independently depending on whether the original maintainer starts maintaining his source as of 4/18/2018. Please use with caution and Watch the source repo for updates.

All the documentation below should still be relevant although items such as build status may not reflect reality for this fork.

Parser

Latest Version on Packagist Build Status Coverage Status Quality Score Total Downloads SensioLabsInsight

Simple PHP Parser Library for API Development, parse a post http payload into a php array.

Also see the Responder library for handling output.

Installation

Begin by installing this package through Composer. From the Terminal:

composer require peterdkc/parser

Laravel/Lumen Users

Laravel/Lumen Verison Supported Library Verison
Laravel/Lumen 5+ > 3.*
Laravel 4 2.*

Laravel Users (Adding the Service Provider)

If you are a Laravel user, then there is a service provider that you can make use of to automatically prepare the bindings and such.

Include the service provider within app/config/app.php.

And, for convenience, add a facade alias to this same file at the bottom:

Lumen Users (Adding the Service Provider)

If you are a Lumen user, then there is a service provider that you can make use of to automatically prepare the binding and such.

Lumen users can also add the facade alias.

Using the Facade

All the examples below assume you aren't using Laravel (or Lumen), and therefore don't have access to the facade. As with any other facade, instead of:

just use:

Usage

Parsing Functions

Parse Input/Payload (PUT/POST)

Helper functions

Mask function

The mask function processes payload data using a configuration mask, thereby returning only a selected subset of the data. It works just like the only method but with the added benefit of allowing you to specify a mask in the form of an array, this means you can generate masks on-the-fly based on system and/or user defined conditions.

Demo
Mask

Defining the mask, masks consist of basic array structure, for this particular example we have some rules for the data to be returned they include:

Sample Payload
Applying the Mask
Output

This is the output generated as a result of applying the mask against the sample payload provided above.

Wildcards/Special Keys (*, %, :first, :last, :index[0], :item[0])

Parse JSON

Parse XML

Parse Query String

Parse Serialized Object

Parse YAML

Parse BSON

Parse MSGPack

Custom Parsers/Formatters

You can make your own custom parsers/formatters by implementing FormatInterface, the below example demostrates the use of a custom parser/formatter.

Using the CustomFormatter

Autodetecting the CustomFormatter

Testing

To test the library itself, run the tests:

composer test

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

Appendix

Supported Content-Types

All versions of parser with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
symfony/yaml Version ~2.0|~3.0|~4.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 peterdkc/parser contains the following files

Loading the files please wait ....