{"id":36574653,"url":"https://github.com/paphper/paper","last_synced_at":"2026-01-12T07:26:28.021Z","repository":{"id":57035787,"uuid":"262416013","full_name":"paphper/paper","owner":"paphper","description":"Static Site Generator in ReactPhp","archived":false,"fork":false,"pushed_at":"2020-05-22T11:12:57.000Z","size":208,"stargazers_count":9,"open_issues_count":3,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-29T06:54:55.112Z","etag":null,"topics":["php","reactphp","ssg"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/paphper.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":"2020-05-08T19:54:36.000Z","updated_at":"2021-01-26T09:16:09.000Z","dependencies_parsed_at":"2022-08-23T20:50:57.710Z","dependency_job_id":null,"html_url":"https://github.com/paphper/paper","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/paphper/paper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paphper%2Fpaper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paphper%2Fpaper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paphper%2Fpaper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paphper%2Fpaper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paphper","download_url":"https://codeload.github.com/paphper/paper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paphper%2Fpaper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28336510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["php","reactphp","ssg"],"created_at":"2026-01-12T07:26:26.378Z","updated_at":"2026-01-12T07:26:28.011Z","avatar_url":"https://github.com/paphper.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Paphper\n\nPaphper is Static Site Generator written on top of ReactPHP.\n\n### Installation\n\n`composer create-project paphper/paper`\n\n##### Docker Support\nYou can use paper on docker too here are some additional steps -:\n* `docker-compose up -d`\n* `docker exec -i paper php run dev` \n* Start building awesome templates\n\n\n### Development\n\n`php paper dev`\n\nThis runs a development server at `http://localhost:8888`. \nThis also looks for changes in the files in the `pages` folder and reflects in the browser.\n\u003e Note: This does not watch for the changes in the `layouts`. So, if you make a change in the layout, \nyou will have to modify something in your page to see the changes in the browser.\nYou can change this port to your choice at [/config.php](/config.php).\n\n### Folder Structure\n\n#### /pages\nThis is where all the pages for the site lives. `.html`, `.md` and [Blade](https://laravel.com/docs/7.x/blade) files are supported as pages. The folder structure of pages decides the routes.    \nFor example:\n- `pages/index.html` will be displayed at `/`\n- `pages/readme.md` will be displayed at `/readme`\n- `pages/posts/post.html` will be displayed at `/posts/post`\n- `pages/blade.blade.php` will be displayed at `/blade`\n\n#### /layouts\nThis is where all the layouts for the site lives. Only html files are supported as layouts.\n\n#### /assets\nThis is where the images, css and other assets live\n\nNote: All of these can be changed here in the [/config.php](/config.php).\n\n### `\u003cpaper\u003e`\nWe include 'meta' for post in a `\u003cpaper\u003e` tag. Meta here means whatever you want to be replaced in the content of the page.\n\n\u003e `{content}` in the layout and `layout` in the `\u003cpaper\u003e` tag are reserved and cannot be used to replace the contents in the page\n\nThe syntax in the template is `{meta}`.\nFor example if you want to add title to a page `{title}`, add a \n```\ntitle: This is the test title\n```\nin your paper tag. \nand in your layout. You would add\n\n```html\n...\n\u003ctitle\u003e{title}\u003c/title\u003e\n...\n\n```\n\nThis will generate \n```html\n\u003ctitle\u003eThis is the test title\u003c/title\u003e\n```\nin the HTML.\n  \nExample paper tag\n```\n\u003cpaper\u003e       \n    description: this is the best description\n    title: This is the test title\n    layout: blog.html\n\u003c/paper\u003e\n``` \n\n### File types supported\n\nPaphper supports three file types for now.\n\n1. Html\n1. Md\n1. [Blade Templates](https://laravel.com/docs/7.x/blade)\n\n### Image resize support\n\nPaphper has support for image resizes as well from a single source file. You can reference size of an image and it will generate that size.   \nFor example:  \nThere is a file [envelope.jpg](/assets/envelope.jpeg) in assets folder. It is referenced in the [index.html](/pages/index.html) \nand in referenced as `/envelope_50x50.jpeg` in [index layout](/layouts/index.html). This will copy the original file and also create a /envelope_50x50.jpeg in the given dimension.  \n\nFor this to work. The image MUST be referenced as fiiname_widthxheight.jpeg.\nFor example:  \nTo generate a 50x50 dimension image for `/envelope.jpeg`, it must be referenced as `/envelope_50x50.jpeg`.\n\n### Building\n\n`php paper build` builds html files into the build folder. Which can be specified [here](/config.php).  \n\n![img](https://i.ibb.co/qrrzYrJ/Screen-Shot-2020-05-18-at-10-25-34-PM.png)\n\n\n## Advance Usage\n\nI have tried to make this thing as flexible and extendable as it can be. Let me explain a bit of architecture to help me explain this.\n\n### Architecture\n\n#### PageResolvers\n\nPageResolver is a simple class that implements [PageResolverInterface.php](https://github.com/paphper/core/blob/master/src/Contracts/PageResolverInterface.php)\n\nThis is the source of the route structure. The functions explained.\n\n1. `getPages` should return what pages are to be build. It should be a Promise that resolver to an array of strings.(`pages`).\n1. `getBuildFilename(string $page)` should return the file that this should be added the parsed content of the page to. MUST be a full path\n1. `getBuildFolder` should return the folder that should be created to place the file. MUST be a full path.  \n\nThe default PageResolver used in Paphper is [FilesystemPageResolver](https://github.com/paphper/core/blob/master/src/PageResolvers/FilesystemPageResolver.php)\nThis scans the folder in the pages folder and retrieves that pages and decides on the files and folder to be created.\n\nThis can be extended to use, for instance, a mysql table with posts and create the page based on the uri of that post.\n\n### FileTypeResolver\n\nContent is the class that interprets any file into HTML. It implements [Contentinterface](https://github.com/paphper/core/blob/master/src/Contracts/ContentInterface.php).\nThe needs to have one function.\n\n1. `resolveFileType(string $filename)` when passes a filename should simple return a `ContentInterface`. \n`ContentInterface` returns promise that resolves to a string. This is the final content that will be written in the HTML file generated.\n\nWe have three FileTypeResolvers at the moment.\n\n1. HtmlResolver\n1. MdResolver\n3. BladeResolver\n\nPaphper uses this interface to internally add support for multiple file types.\n\n### MetaInterface\n\nMeta parser parses the meta in a page. The default meta parser is [Paper Tag Parser](https://github.com/paphper/core/blob/master/src/Parsers/AbstractPaperTagParser.php) which implements [MetaInterfaec](https://github.com/paphper/core/blob/master/src/Contracts/MetaInterface.php)\n`Paper Tag Parser` as name suggests the `\u003cpaper\u003e` tag on top of the files.\n\nYou can implement your own meta parser as well. The functions explained.\n\n1. `getBody` this should be able to get the body of the page without the meta that will be written to the HTML.\n1. `getLayout` this should be able to get the layout that will be used. In case of blade templates, this is not required because it is handled by blade itself.\n1. `getLayoutContent` should get the content of the layout so that the meta and content could be passed to this.\n1. `get` this should return meta value on passing the meta key\n1. `getExtraMetas` this is all the metas\n1. `process` returns a promise. Since we are working with promises for filesystem, the file has to be read once to process content of the page. \nIf we process promises individually in every call it becomes hard to return as types and becomes a callback hell. \nHence we call the process function to set all the properties.\n\n### Putting this together\n\nWe basically put this together to create a static site. \n\nhttps://github.com/paphper/core/blob/master/paper#L26-L43. These are the defaults used in `paper`. You can customize and write you own. I am planning to add more. \nLet me know what should be added to this. Create a PR or issues for suggestions, contributions and feedback.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaphper%2Fpaper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaphper%2Fpaper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaphper%2Fpaper/lists"}