Download the PHP package open-southeners/laravel-vapor-response-compression without Composer

On this page you can find all versions of the php package open-southeners/laravel-vapor-response-compression. 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-vapor-response-compression

Laravel Response Compression required php version codecov Edit on VSCode online

Add server-side response compression with a range of different algorithms (Gzip, brotli, deflate...)

Why use this package?

The reason why is because AWS hard limit its API Gateway service to 10MB (at the date of writing this), and by hard we mean that there's no way you can increase this limitation.

Note: Thought CloudFlare is a good solution for the end user, it doesn't solve this issue as CloudFlare does this between the server and the client, so the response already passed through AWS (API Gateway).

Read more here: https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#http-api-quotas

Or on our blog article: https://opensoutheners.com/how-to-prevent-large-responses-to-trigger-502-errors

Getting started

Then publish the configuration file defaults into your application's config folder:

Then add the following to you app/Http/Kernel.php as a global middleware:

Note: Remember this is different in older versions of Laravel, Laravel 9 should look like the following.

Configuration

If you already have this config/response-compression.php file, you can skip this step, otherwise please use the following artisan command first:

Note: As for smaller responses this threshold will prevent to compress the response if it doesn't reach an specific number of bytes. We encourage you to configure this and not leave it as ±0 bytes otherwise response will be always compressed.

This configuration is defaulted to 10000 bytes, you may customise this as your application demands.

Setting up Brotli extension in Vapor

First of all, this will require you to use Docker containers on your Vapor environments if you're not familiar with them, you can still use this extension as it uses the first client requested algorithm available at server side.

👉 Read more about using containers in Vapor here

Anyway, in case you want to proceed, add this to your environment Dockerfile(s), please use comments as references only:

And ensure your project depends on vdechenaux/brotli.

Alternative Brotli setup

Another alternative is to use: https://github.com/kjdev/php-ext-brotli

TODO: Setup instructions for Vapor/Dockerfile

Credits


All versions of laravel-vapor-response-compression with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^8.0
ext-zlib Version ^7.2 || ^8.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 open-southeners/laravel-vapor-response-compression contains the following files

Loading the files please wait ....