{"id":24565977,"url":"https://github.com/steffenbrand/html-compress-middleware","last_synced_at":"2025-04-22T10:35:53.865Z","repository":{"id":57059472,"uuid":"126643797","full_name":"steffenbrand/html-compress-middleware","owner":"steffenbrand","description":"PSR-15 compliant html compress middleware","archived":false,"fork":false,"pushed_at":"2018-03-25T02:44:57.000Z","size":104,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-22T10:35:47.881Z","etag":null,"topics":["html-compressing","middleware","psr-11","psr-15","psr-7","zend-expressive3"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steffenbrand.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-24T22:01:28.000Z","updated_at":"2018-08-21T10:05:41.000Z","dependencies_parsed_at":"2022-08-24T07:40:11.046Z","dependency_job_id":null,"html_url":"https://github.com/steffenbrand/html-compress-middleware","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steffenbrand%2Fhtml-compress-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steffenbrand%2Fhtml-compress-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steffenbrand%2Fhtml-compress-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steffenbrand%2Fhtml-compress-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steffenbrand","download_url":"https://codeload.github.com/steffenbrand/html-compress-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250221580,"owners_count":21394733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html-compressing","middleware","psr-11","psr-15","psr-7","zend-expressive3"],"created_at":"2025-01-23T12:17:42.530Z","updated_at":"2025-04-22T10:35:53.797Z","avatar_url":"https://github.com/steffenbrand.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/steffenbrand/html-compress-middleware/v/stable)](https://packagist.org/packages/steffenbrand/html-compress-middleware)\n[![Total Downloads](https://poser.pugx.org/steffenbrand/html-compress-middleware/downloads)](https://packagist.org/packages/steffenbrand/html-compress-middleware)\n[![Build Status](https://scrutinizer-ci.com/g/steffenbrand/html-compress-middleware/badges/build.png?b=master)](https://scrutinizer-ci.com/g/steffenbrand/html-compress-middleware/build-status/master)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/steffenbrand/html-compress-middleware/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/steffenbrand/html-compress-middleware/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/steffenbrand/html-compress-middleware/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/steffenbrand/html-compress-middleware/?branch=master)\n\n# HTML Compress Middleware\nPSR-15 compliant middleware to compress html responses.\n\n* [HTML Compress Middleware on Packagist](https://packagist.org/packages/steffenbrand/html-compress-middleware)\n* [HTML Compress Middleware on GitHub](https://github.com/steffenbrand/html-compress-middleware)\n\n![Concept](https://github.com/steffenbrand/html-compress-middleware/blob/master/concept.jpg?raw=true)\n\n## How to install\n\n```\ncomposer require steffenbrand/html-compress-middleware\n```\n\n## How to use with Zend Expressive 3\n\nAdd the middleware to your `config/pipeline.php`\n\n```php\n/**\n * Setup middleware pipeline:\n */\nreturn function (Application $app, MiddlewareFactory $factory, ContainerInterface $container) : void {\n    // The error handler should be the first (most outer) middleware to catch\n    // all Exceptions.\n    $app-\u003epipe(ErrorHandler::class);\n    $app-\u003epipe(HtmlCompressMiddleware::class);\n    ...\n }\n```\n\nAdd the middleware to your `config/autoload/dependencies.global.php`  \nOr use it as a [routed middleware](https://zendframework.github.io/zend-expressive/v3/getting-started/features/#flow-overview), if you don't want the middleware to be invoked on certain routes.\n\n```php\nreturn [\n    // Provides application-wide services.\n    // We recommend using fully-qualified class names whenever possible as\n    // service names.\n    'dependencies' =\u003e [\n        ...\n        'factories'  =\u003e [\n            // Fully\\Qualified\\ClassName::class =\u003e Fully\\Qualified\\FactoryName::class,\n            \\SteffenBrand\\HtmlCompressMiddleware\\HtmlCompressMiddleware::class =\u003e \\SteffenBrand\\HtmlCompressMiddleware\\HtmlCompressMiddlewareFactory::class,\n        ],\n    ],\n];\n```\n\n### Enable compression\n\nTo enable compression disable the development mode.  \nHTML compression is only meant for production.\n\n```\ncomposer development-disable\n```\n\n### Disable compression\n\nTo disable compression enable the development mode.   \nHTML compression will not run in development mode.\n\n```\ncomposer development-enable\n```\n\nOr provide your own development-mode settings by editing the file `config/autoload/development.local.php.dist`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteffenbrand%2Fhtml-compress-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteffenbrand%2Fhtml-compress-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteffenbrand%2Fhtml-compress-middleware/lists"}