{"id":26693858,"url":"https://github.com/slogsdon/php-flat-file","last_synced_at":"2025-06-30T22:05:50.757Z","repository":{"id":57053406,"uuid":"141671436","full_name":"slogsdon/php-flat-file","owner":"slogsdon","description":"Fast static-site generator / flat-file CMS","archived":false,"fork":false,"pushed_at":"2024-12-30T04:49:02.000Z","size":86,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-13T23:38:32.382Z","etag":null,"topics":["flat-file-cms","static-site-generator","zero-configuration"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/slogsdon/flat-file","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/slogsdon.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-20T06:16:18.000Z","updated_at":"2024-12-27T15:16:50.000Z","dependencies_parsed_at":"2024-12-30T05:26:51.914Z","dependency_job_id":"52b2cfd2-0010-4faa-be95-d359c7869873","html_url":"https://github.com/slogsdon/php-flat-file","commit_stats":{"total_commits":34,"total_committers":1,"mean_commits":34.0,"dds":0.0,"last_synced_commit":"dde24d90535c50aa4fecdb2be03061f2eb2cccbc"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/slogsdon/php-flat-file","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slogsdon%2Fphp-flat-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slogsdon%2Fphp-flat-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slogsdon%2Fphp-flat-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slogsdon%2Fphp-flat-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slogsdon","download_url":"https://codeload.github.com/slogsdon/php-flat-file/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slogsdon%2Fphp-flat-file/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262857264,"owners_count":23375489,"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":["flat-file-cms","static-site-generator","zero-configuration"],"created_at":"2025-03-26T18:27:31.239Z","updated_at":"2025-06-30T22:05:50.686Z","avatar_url":"https://github.com/slogsdon.png","language":"PHP","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# flat-file\n\n[![Latest Stable Version](https://poser.pugx.org/slogsdon/flat-file/v/stable)](https://packagist.org/packages/slogsdon/flat-file)\n[![Total Downloads](https://poser.pugx.org/slogsdon/flat-file/downloads)](https://packagist.org/packages/slogsdon/flat-file)\n[![Latest Unstable Version](https://poser.pugx.org/slogsdon/flat-file/v/unstable)](https://packagist.org/packages/slogsdon/flat-file)\n[![License](https://poser.pugx.org/slogsdon/flat-file/license)](https://packagist.org/packages/slogsdon/flat-file)\n[![Build Status](https://travis-ci.com/slogsdon/php-flat-file.svg?branch=master)](https://travis-ci.com/slogsdon/php-flat-file)\n[![Maintainability](https://api.codeclimate.com/v1/badges/953549537e6505fdd83d/maintainability)](https://codeclimate.com/github/slogsdon/php-flat-file/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/953549537e6505fdd83d/test_coverage)](https://codeclimate.com/github/slogsdon/php-flat-file/test_coverage)\n\n\u003e Fast static-site generator / flat-file CMS\n\n[View an example project.](https://github.com/slogsdon/php-flat-file-starter)\n\n### Features\n\n- Needs zero configuration\n- Uses Markdown, HTML, or PHP\n- Routes based on file system\n- Exports static sites, or runs via PHP powered web servers\n- Includes development environment\n\n### Reasoning\n\nPHP is easy to install, if not already present on you computer. PHP runs pretty much everywhere. PHP is flexible.\n\nThis project also scratches an itch to see how much PHP can handle in this problem domain.\n\n## Requirements\n\n- [PHP 7.1+](http://www.php.net/)\n- [Composer](https://getcomposer.org/)\n\n## Getting Started\n\n```json\n{\n    \"name\": \"user/site\",\n    \"description\": \"\",\n    \"require\": {\n        \"slogsdon/flat-file\": \"dev-master\"\n    },\n    \"scripts\": {\n        \"build\": \"flat-file build\",\n        \"start\": \"flat-file serve\"\n    },\n    \"config\": {\n      \"process-timeout\": 0\n    }\n}\n```\n\nThe `scripts` and `config` sections are not required, but they do help simplify the development process. If using the `start` script, the `process-timeout` configuration option allows Composer to run a script for longer than the default timeout (300 seconds).\n\nIf not using Composer script configurations, you'll need to reference the `flat-file` script as `vendor/bin/flat-file`, e.g.:\n\n```\nvendor/bin/flat-file build\nvendor/bin/flat-file serve\n```\n\nAfter setting up your `composer.json` file, don't forget to pull down your dependencies:\n\n```\ncomposer install\n```\n\n### Adding Content\n\nNext, your individual pages need to be included in a `pages` directory at the root of your project (i.e. next to your `composer.json` file). Pages can be written in Markdown (with the `.md` or `.markdown` file extension), plain HTML, or PHP (with the `.php` file extension). PHP files have the option of outputing the content as normal (echo, print, content outside of `\u003c?php ?\u003e` tags, etc.) or returning the content as a string (`\u003c?php return 'hello world';`).\n\n\n```php\n\u003c?php /* pages/index.php */ ?\u003e\n\u003ch1\u003eHello World\u003c/h1\u003e\n```\n\nAdd more pages with new files under `pages`, e.g.:\n\n```markdown\n\u003c!-- pages/about.md --\u003e\n# About\n```\n\n### Running the Development Server\n\nReady to test? Spin up the development server:\n\n```\ncomposer start\n```\n\nThis will start a PHP development server listening on `http://localhost:3000`. Pressing `Ctrl-C` will stop the server, freeing the way for building your project to plain HTML files for later deployment.\n\n### Building Static Files\n\nKick off a build of the site:\n\n```\ncomposer build\n```\n\nIgnoring Composer's `vendor` directory, you should see something similar to below in your project root once all is said and done:\n\n```\n.\n├── composer.json\n├── composer.lock\n├── dist\n│   ├── about.html\n│   └── index.html\n├── pages\n└── vendor\n```\n\n### Using a Custom Entrypoint\n\nBy default, we provide an entrypoint for the webserver to use when serving requests. It completes some rewrites for files in `public`, requires the Composer autoloader, and kicks off the application. You can elect to include your own by creating a new entrypoint named `index.php` and put it in the `public` directory at the root of your project. Here's the default one for reference:\n\n```php\n\u003c?php declare(strict_types=1);\n\n$uri = $_SERVER['REQUEST_URI'];\n\nif ($uri !== '/' \u0026\u0026 file_exists(getcwd() . '/public' . $uri)) {\n    return false;\n}\n\nrequire getcwd() . '/vendor/autoload.php';\nnew FlatFile\\Application;\n```\n\n### Running as a Flat-File CMS\n\nIf you wish to run your project with a PHP-enabled web server as a flat-file CMS instead of a static site, you'll want to:\n\n1. Configure your web root to be `public`\n2. Use a custom entrypoint or configure your web server to have `vendor/slogsdon/flat-file/src/router.php` serve any non-existent paths.\n\nYour web server will then be able to serve static assets from `public` as it normally would and also any pages you create.\n\n## F.A.Q.\n\n\u003cdl\u003e\n  \u003cdt\u003eWhat about LiveReload like functionality?\u003c/dt\u003e\n  \u003cdd\u003eThat's being investigated, but use \u003ccode\u003eF5\u003c/code\u003e/\u003ccode\u003eCmd-R\u003c/code\u003e for the time being.\u003c/dd\u003e\n\u003c/dl\u003e\n\n## License\n\nThis project is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslogsdon%2Fphp-flat-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslogsdon%2Fphp-flat-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslogsdon%2Fphp-flat-file/lists"}