Download the PHP package nylo/dejajson without Composer

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

dejajson

Give zlib déjà vu.

Your API keeps sending the same shapes — the same keys, the same enum values, the same URL prefixes and timestamp formats. Generic compression (gzip, brotli, SmallJson's deflate mode) rediscovers that from scratch on every response, which is why it does so little for the small payloads real apps send most. DejaJson trains a shared compression dictionary on samples of your own responses; from then on the compressor has effectively already seen each response before it starts, and only the genuinely new bytes cost anything.

Measured on realistic Laravel API payloads (php bin/benchmark.php):

Payload plain JSON transport gzip dejajson d
single resource 693 B 437 B (−37%) 58 B (−92%)
list of 25 17,469 B 1,581 B (−91%) 887 B (−95%)
list of 200 137,919 B 8,002 B (−94%) 7,303 B (−95%)

The same idea is being standardised for the web as RFC 9842 (Compression Dictionary Transport); DejaJson applies it to APIs you control both ends of, over a simple negotiation header. Pairs with the dejajson Dart package: a drop-in Dio interceptor restores plain JSON before your Flutter app sees it.

Getting started

Register the middleware on your API routes (or globally in the api group):

That's already worth ~gzip. The big win needs a dictionary:

The command writes storage/app/dejajson/dictionary.bin (override with DEJAJSON_DICTIONARY or --out) and prints its id. Ship that exact file inside your app — for Flutter, copy it into the project's assets and hand it to the interceptor (see the Dart package README). Clients advertise the id automatically; the server uses dictionary mode whenever the ids match.

Retraining later is safe: a client still holding the old dictionary just falls back to mode z until its next app update.

The macro

For hand-picked endpoints instead of (or as well as) the middleware:

Options

php artisan vendor:publish --tag=dejajson-config

Key Default
enabled true Master switch — off means plain response()->json() behaviour.
modes 'dz' What this server will produce; d engages only once a dictionary is trained.
negotiate true Only encode for clients sending the request header.
request_header X-Deja-Json Must match the interceptor's requestHeader.
dictionary.path storage/app/dejajson/dictionary.bin Where the trained dictionary lives.
min_bytes 0 Skip payloads smaller than this outright.
only_when_smaller true If encoding wouldn't shrink the body, send plain JSON.
level 6 zlib level 1–9.
stats_header false Adds X-Deja-Json-Stats: mode=d; dict=…; plain=…; sent=…; saved=…%.

Manual use

The codec is framework-free — queues, websockets, cache blobs:

Wire format (v1)

Sent with content type application/vnd.dejajson. zlib framing is deliberate: the stream embeds an Adler-32 of the dictionary (so a wrong dictionary fails loudly) and of the content (so corruption does too) — and Dart's ZLibCodec only honours preset dictionaries on zlib-framed streams.

Notes

Testing

License

MIT © Anthony Gordon


All versions of dejajson with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
ext-zlib Version *
illuminate/console Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.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 nylo/dejajson contains the following files

Loading the files please wait ...