Download the PHP package jeffersongoncalves/jq-cli without Composer

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

![jq-cli](https://raw.githubusercontent.com/jeffersongoncalves/jq-cli/main/art/jeffersongoncalves-jq-cli.png)

jq-cli

Buy Me A Coffee

A jq clone written in pure PHP on top of Laravel Zero. It implements the jq language with its own lexer, parser and generator-based interpreter — not field extraction with regexes — so stream semantics ([], ,, //, recurse, reduce, ...) behave like the real thing.

It is Windows-first: distributed as a PHAR plus .bat wrappers so jq finally works in CMD/PowerShell without installing the native binary, WSL, or fighting with the Git Bash PATH.


Tests Total Downloads License PHP 8.2+

Why isn't jq found on Windows?

On Windows jq "is never found" for a stack of reasons:

jq-cli fixes this by being self-contained: given a PHP runtime, the jq.bat wrapper runs a PHAR that interprets the jq language directly. No native jq, no WSL, no Git Bash PATH surgery.

Quoting on Windows: in CMD use double quotes and escape inner quotes as \". In PowerShell use double quotes or single quotes. The examples below use double quotes so they work in CMD. For complex programs, put the filter in a file and use -f program.jq.


Installation

Requirements

Option A — Composer (recommended)

Make sure Composer's global bin directory is on your PATH:

Then the jq command is available everywhere:

Option B — Standalone PHAR (Windows, no Composer)

  1. Build the PHAR (see Building) or grab jq.phar from the releases page.
  2. Copy jq.phar and jq.bat into a folder, e.g. %USERPROFILE%\bin.
  3. Add that folder to your user PATH:

  4. Reopen your terminal so the new PATH takes effect.

Now jq works from CMD and PowerShell.


Usage

If no files are given, input is read from STDIN. Multiple concatenated JSON documents and NDJSON are both supported.

Options

Flag Behaviour
-n, --null-input Input is null; do not read stdin for the main loop
-r, --raw-output Output strings without quotes
-j, --join-output Like -r but without a trailing newline
-c, --compact-output Compact (no indentation) JSON
-s, --slurp Read the whole input into a single array
-R, --raw-input Each line of input becomes a JSON string
-a, --ascii-output Escape non-ASCII as \uXXXX
-S, --sort-keys Sort object keys in the output
-e, --exit-status Exit code reflects the last output value
--tab Indent with tabs
--indent N Indent with N spaces
--arg name value Bind $name to the string value
--argjson name json Bind $name to a parsed JSON value
--slurpfile name file Bind $name to the array of JSON values in file
--rawfile name file Bind $name to the raw contents of file
--args / --jsonargs Remaining args populate $ARGS.positional
-f, --from-file file Read the filter program from file

Short flags can be combined: jq -rc ".[]".

Exit codes (jq parity)

Code Meaning
0 Success, output produced
1 With -e, the last output was false or null
2 Usage error (invalid flags)
3 Program compile error (parse error, with line:column)
4 With -e, no output was produced
5 I/O error or invalid JSON in the input

Language coverage


Architecture

Every expression evaluates to a PHP \Generator, so a filter can emit zero, one or many values — the core requirement for honest jq semantics.


Development

Building

The Laravel Zero app:build command uses Box, whose temp-directory cleanup is unreliable on Windows. A dependency-free builder is included:

This produces builds/jq.phar. For a much smaller binary, install runtime-only dependencies first:

The builds/jq.bat wrapper simply calls php jq.phar %*.


Compatibility & known divergences

This is a faithful but not byte-identical reimplementation. Known differences from reference jq:

Found a divergence? Open an issue — golden tests live in tests/Feature.

License

MIT © Jefferson Goncalves


All versions of jq-cli with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
ext-mbstring 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 jeffersongoncalves/jq-cli contains the following files

Loading the files please wait ...