{"id":26796416,"url":"https://github.com/peterujah/ob-compress","last_synced_at":"2025-04-22T19:57:53.502Z","repository":{"id":57038183,"uuid":"462897968","full_name":"peterujah/ob-compress","owner":"peterujah","description":"Php compress Output Buffer In Gzip","archived":false,"fork":false,"pushed_at":"2023-08-04T22:42:03.000Z","size":38,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T18:18:35.327Z","etag":null,"topics":[],"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/peterujah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-23T20:38:50.000Z","updated_at":"2023-04-21T13:20:10.000Z","dependencies_parsed_at":"2022-08-23T23:30:55.014Z","dependency_job_id":null,"html_url":"https://github.com/peterujah/ob-compress","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fob-compress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fob-compress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fob-compress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fob-compress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterujah","download_url":"https://codeload.github.com/peterujah/ob-compress/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250315961,"owners_count":21410473,"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":[],"created_at":"2025-03-29T18:18:38.074Z","updated_at":"2025-04-22T19:57:53.465Z","avatar_url":"https://github.com/peterujah.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ob-compress\nPhp OBCompress, compresses the Output Buffer In Gzip\n\nThis class can compress the output buffer of a web page or web request.\n\nIt can start capturing the output buffer of the current HTTP request and compress using the gzip compression method or none based on specified options. The compressed output will be send with the necessary headers back to user browser and optimized. It can process the responses of requests and output data in JSON, HTML, or plain text format faster than regular request output.\n\n## Installation\n\nInstallation is super-easy via Composer:\n```md\ncomposer require peterujah/ob-compress\n```\n\nTo compress webpage output, see the below example code\n\n```php \n\u003c?php \nuse Peterujah\\NanoBlock\\OBCompress;\nOBCompress::start()\n?\u003e\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n\u003ctitle\u003eText OB Compress\u003c/title\u003e\n\u003c/head\u003e\n  \u003cbody\u003e\n    This will be compress and optimized\n  \u003c/body\u003e\n\u003c/html\u003e\n\u003c?php (new OBCompress())-\u003eend();\n```\n\nTo retrieve data from server it can be done like below\n```php\nuse Peterujah\\NanoBlock\\OBCompress;\n$response = array(\n  \"foo\" =\u003e \"Foo\",\n  \"bar\" =\u003e \"Bar\"\n);\n(new OBCompress())-\u003ejson($response);\n```\n\nAvailable Response methods\n\nShort Hand to compress data and return as json\n```php \n$compress-\u003ejson($data);\n```\nShort Hand to compress data and return as plain text\n```php \n$compress-\u003etext($data);\n```\nShort Hand to compress data and return as html document\n```php \n$compress-\u003ehtml($data);\n```\nShort Hand to compress data and return as specied content type\n```php \n$compress-\u003erun($data, $contentType);\n```\nStrips and minify a webpage content, start output buffer on webpage, place at the beginning of a webpage\n```php \n$compress-\u003estart();\n```\nShort Hand to get output buffer of a webpage and compress it then return as spacied data type\n```php \n$compress-\u003eend($contentType);\n```\nRrturns compressed output from passed data, sets the status code and data type\n```php \n$compress-\u003ewith($data, $statusCode, $contentType);\n```\nA function to strips and minify a webpage content, this can be passed to `ob_start('OBCompress::minify');`\n```php \n$compress::minify($content);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterujah%2Fob-compress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterujah%2Fob-compress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterujah%2Fob-compress/lists"}