{"id":18273274,"url":"https://github.com/spacetab-io/static-server-php","last_synced_at":"2026-04-11T08:03:49.146Z","repository":{"id":105021748,"uuid":"263911573","full_name":"spacetab-io/static-server-php","owner":"spacetab-io","description":"Server dynamically configures web application that requires a static configuration without needs to rebuild it.","archived":false,"fork":false,"pushed_at":"2024-12-03T00:09:39.000Z","size":1502,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T03:35:59.667Z","etag":null,"topics":["brotli-compression","compression","gzip","nginx","php","prerender","server","spa","vuejs"],"latest_commit_sha":null,"homepage":"https://spacetab.io","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/spacetab-io.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2020-05-14T12:40:43.000Z","updated_at":"2022-09-05T12:58:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"4c4b7089-0c18-4c0e-8a86-aea071960901","html_url":"https://github.com/spacetab-io/static-server-php","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/spacetab-io/static-server-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fstatic-server-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fstatic-server-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fstatic-server-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fstatic-server-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacetab-io","download_url":"https://codeload.github.com/spacetab-io/static-server-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fstatic-server-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31673068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"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":["brotli-compression","compression","gzip","nginx","php","prerender","server","spa","vuejs"],"created_at":"2024-11-05T12:05:49.996Z","updated_at":"2026-04-11T08:03:49.128Z","avatar_url":"https://github.com/spacetab-io.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Static server\n-------------\n\n[![CircleCI](https://circleci.com/gh/spacetab-io/static-server-php/tree/master.svg?style=svg)](https://circleci.com/gh/spacetab-io/static-server-php/tree/master)\n[![codecov](https://codecov.io/gh/spacetab-io/static-server-php/branch/master/graph/badge.svg)](https://codecov.io/gh/spacetab-io/static-server-php)\n\nServer dynamically configures web application that requires a static configuration without needs to rebuild it.\nThis server is a simple wrapper for nginx or an any web server.\n\nCompatible with: Vue, React, Angular, etc.\n\n## Table of contents\n\n* [Features](#features)\n* [Usage](#usage)\n    + [Dockerfile sample](#dockerfile-sample)\n    + [Local integration with modern web apps](#local-integration-with-modern-web-apps)\n    + [Command line interface](#command-line-interface)\n    + [Prerender \u0026 SEO](#prerender--seo)\n    + [Headers](#headers)\n    + [Link header](#link-header)\n* [How it works](#how-it-works)\n* [Compression](#compression)\n* [Environment variables](#environment-variables)\n* [Default files in the root directory](#default-files-in-the-root-directory)\n* [Tests](#tests)\n* [License](#license)\n\n## Features\n\n* Special created for modern web app's.\n* Secure headers by default.\n* If backend app will be hacked, the hacker may write a letter to us, because email address injected to head section of index (console message) :)\n* Corporate config standard supported by default and injected too.\n* Brotli-compression (Gzip used as fallback for outdated browsers). Enabled by default. [More](#Compression).\n* Deny all `robots.txt` by default.\n* Hot reload\n\n## Usage\n\n### Dockerfile sample\n```Dockerfile\nFROM spacetabio/static-server-php:4.1.0\n\nARG VCS_SHA1\nARG STAGE\n\n# dist \u0026 frontend yaml configuration \nCOPY dist/ /app\nCOPY ./configuration /app/configuration\n```\n\n### Local integration with modern web apps\n\nFull example can be founded [here](https://github.com/spacetab-io/configuration-js#how-to-usage-library-with-spa-apps).\n\n### Command line interface\n\nCLI usage implies 2 commands for usage:\n\n1) Start server:\n```bash\nserver run\n```\n\n2) Reload\n\nAfter editing files or configuration you can reload the server without restart master process.\n\n```bash\nserver reload\n```\n\n3) Dump loaded configuration:\n```bash\nserver dump\n```\n\nComments about server configuration can be found [here](./configuration/defaults).\n\n### Prerender \u0026 SEO\n\nIf you would like to optimize web-site for search-indexing bots, \nserver supports integration with this prerender in the box:\n  \nhttps://github.com/spacetab-io/prerender-go\n\n### Headers\n\nBy default, will be added following headers to response:\n\n```http\nPragma: public\nX-XSS-Protection: 1; mode=block\nX-Frame-Options: SAMEORIGIN\nX-Content-Type: nosniff\nX-Content-Type-Options: nosniff\nX-Ua-Compatible: IE=edge\nReferrer-Policy: no-referrer\n```\n\n### Link header\n\nAs new feature since `1.1.4` version you able to use `Link` header\nfor server configuration.\n\n* How it use for `\u003clink rel=preload\u003e` requirements (lighthouse), – https://w3c.github.io/preload/#example-3 , https://w3c.github.io/preload/#example-6\n* Specification https://tools.ietf.org/html/rfc5988#section-5\n\nExample:\n\n```yaml\ndev:\n  server:\n    headers:\n      link:\n        - value: \u003c/app/style.css\u003e; rel=preload; as=style; nopush\n        - value:\n            - \u003chttps://example.com/app/script.js\u003e\n            - rel=preload\n            - as=script\n```\n\n## How it works?\n\nServer reads files from `dist`, then modifying `index.html` on the fly \nand append a configuration before first `\u003cscript\u003e` tag will be founded.\nAlso, available [insert config before first tag](./configuration/defaults/___server.yaml#L8) to `\u003chead\u003e` \nsection (but it blocks page painting).\n\nInjected config file (`__config.js`) has following content:\n\n```js\nwindow.__stage = 'local';\nwindow.__config = JSON.parse('{}' /* frontend config from yaml here */);\nwindow.__vcs = '%s';\n```\n\nAlso, will be injected `\u003clink\u003e` tag with `rel=preload`. [More](https://developers.google.com/web/tools/lighthouse/audits/preload).\n\nThen, starts the nginx server.\n\n## Compression\n\nBy default, server use Brotli-compression algorithm developed by [Google Inc](https://en.wikipedia.org/wiki/Brotli). \u003cbr\u003e\nIf a more [effective](https://medium.com/oyotech/how-brotli-compression-gave-us-37-latency-improvement-14d41e50fee4) \n(up to 21%) lossless compression algorithm than gzip and deflate.\u003cbr\u003e\n\u003cbr\u003e\nFor the present, his support all modern browsers:\nhttps://caniuse.com/#search=Brotli\n\n## Environment variables\n\nServer read the following environment variables:\n\n```bash\nCONFIG_PATH – server and frontend configuration.\nSTAGE – server and frontend mode to start: prod/dev/local\nVCS_SHA1 – build commit sha1 for debug\n```\n\n## Default files in the root directory\n\nBy default, root directory is `/app`. It special for container-based usage. \u003cbr\u003e\nRoot directory contains following files from scratch:\n```\n.\n├── favicon.ico\n├── index.html\n└── robots.txt\n```\n\n* `favicon.ico` – is a transparent `.ico` file (for prevent error logs).\n* `index.html` – simple index file with hello message.\n* `robots.txt` – the file which blocks all robots by default.\n* `/.well-known/security.txt` – https://securitytxt.org/\n\nEach file can be replaced.\n\n## Tests\n\nInstall packages for development using composer and just run following command:\n\n```\nvendor/bin/phpunit\n```\n\n## License\n\nThe MIT License\n\nCopyright © 2021 spacetab.io, Inc. https://spacetab.io\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacetab-io%2Fstatic-server-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacetab-io%2Fstatic-server-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacetab-io%2Fstatic-server-php/lists"}