{"id":23120438,"url":"https://github.com/dyerc/craft-litespeed","last_synced_at":"2025-08-14T00:20:46.572Z","repository":{"id":244393904,"uuid":"815113158","full_name":"dyerc/craft-litespeed","owner":"dyerc","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-16T14:47:13.000Z","size":74,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"v4","last_synced_at":"2025-07-29T07:39:13.193Z","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/dyerc.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-14T11:32:59.000Z","updated_at":"2024-07-16T14:47:16.000Z","dependencies_parsed_at":"2024-06-14T13:03:36.116Z","dependency_job_id":"a42cb275-8c74-4f61-bfd9-13442153df42","html_url":"https://github.com/dyerc/craft-litespeed","commit_stats":null,"previous_names":["dyerc/craft-litespeed"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dyerc/craft-litespeed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyerc%2Fcraft-litespeed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyerc%2Fcraft-litespeed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyerc%2Fcraft-litespeed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyerc%2Fcraft-litespeed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dyerc","download_url":"https://codeload.github.com/dyerc/craft-litespeed/tar.gz/refs/heads/v4","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyerc%2Fcraft-litespeed/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270338766,"owners_count":24567183,"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","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2024-12-17T06:10:35.565Z","updated_at":"2025-08-14T00:20:46.500Z","avatar_url":"https://github.com/dyerc.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Stable Version](https://img.shields.io/packagist/v/dyerc/craft-litespeed?label=stable)](\u003c(https://packagist.org/packages/dyerc/craft-litespeed)\u003e)\n[![Total Downloads](https://img.shields.io/packagist/dt/dyerc/craft-litespeed)](https://packagist.org/packages/dyerc/craft-litespeed)\n\n\u003cp align=\"center\" style=\"margin-bottom: 16px;\"\u003e\u003cimg width=\"130\" src=\"https://raw.githubusercontent.com/dyerc/craft-litespeed/master/src/icon.svg\"\u003e\u003c/p\u003e\n\n# LiteSpeed Plugin for Craft CMS\n\nA very simple integration with the LiteSpeed web server and LSCache for Craft CMS. The entire LSCache is cleared any time an entry is saved. For a more sophisticated caching solution, try [Blitz](https://putyourlightson.com/plugins/blitz).\n\n## Installation\n\nTo install the plugin, search for “LiteSpeed” in the Craft Plugin Store, or install manually using composer.\n\n```shell\ncomposer require dyerc/craft-litespeed\n```\n\nUpdate your `.htaccess` to include a block enabling caching for everywhere except the admin area. The following example will cache all pages for 8 hours (`28800` seconds) with the exception of any `/admin` URLs:\n\n```apacheconf\n########## Begin - Litespeed cache\n\u003cIfModule LiteSpeed\u003e\n  RewriteEngine On\n  RewriteCond %{REQUEST_METHOD} ^HEAD|GET$\n  RewriteCond %{ORG_REQ_URI} !/admin\n  RewriteCond %{ORG_REQ_URI} !/index.php/admin\n  RewriteRule .* - [E=Cache-Control:max-age=28800]\n\u003c/IfModule\u003e\n########## End - Litespeed cache\n```\n\nIf you would like to exclude some other page from cache (let's say, `/mypage.php`), simply add the following line to the existing rewrite conditions:\n\n```apacheconf\nRewriteCond %{ORG_REQ_URI} !/mypage.php\n```\n\nIf you want to cache your site for only 4 hours, you can change the max-age. So, it would be:\n\n```apacheconf\nRewriteRule .* - [E=Cache-Control:max-age=14400]\n```\n\n#### LSCache Check Tool\n\nThere's a simple way to see if a URL is cached by LiteSpeed: the [LSCache Check](https://check.lscache.io/) Tool. Enter the URL you wish to check, and the tool will respond with an easy-to-read Yes or No result.\n\n## CSRF Helpers\n\nAny CSRF values (for example `{{ csrfInput() }}`) will be cached by LiteSpeed, preventing forms from working correctly. There are two built-in options for working around this situation:\n\nAutomatically inject a script into every page which looks for CSRF inputs, fetches a valid value asynchronously after page load and substitutes in the new value. Configure the plugin to do this be creating a `config/litespeed.php` file containing:\n\n```php\n\u003c?php\n\nreturn [\n  \"production\" =\u003e [\n    // Or '*' for all environments\n    \"injectCsrf\" =\u003e true,\n  ],\n];\n```\n\nOn a manual basis by calling the following twig function.\n\n```twig\n{{ craft.litespeed.injectCsrf() }}\n```\n\nA JavaScript variable `window.LiteSpeed` will also become available containing the following which can be used by any JavaScript within your site which needs to locate a CSRF param.\n\n```js\n\u003e window.LiteSpeed\n{\n  tokenName: \"CRAFT_CSRF_TOKEN\",\n  tokenValue: \"...\"\n}\n```\n\n## Requirements\n\nThis plugin requires [Craft CMS](https://craftcms.com/) 4.0.0 or later.\n\n---\n\nCreated by [Chris Dyer](https://cdyer.co.uk).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdyerc%2Fcraft-litespeed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdyerc%2Fcraft-litespeed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdyerc%2Fcraft-litespeed/lists"}