{"id":13673846,"url":"https://github.com/phly/PhlyBlog","last_synced_at":"2025-04-28T13:31:54.628Z","repository":{"id":3444719,"uuid":"4497650","full_name":"phly/PhlyBlog","owner":"phly","description":"Laminas MVC module for creating a static blog.","archived":false,"fork":false,"pushed_at":"2021-12-17T02:20:36.000Z","size":266,"stargazers_count":47,"open_issues_count":4,"forks_count":15,"subscribers_count":14,"default_branch":"2.2.x","last_synced_at":"2025-04-01T18:12:08.160Z","etag":null,"topics":["hacktoberfest","laminas-mvc"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phly.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2012-05-30T17:19:20.000Z","updated_at":"2024-05-21T13:26:53.000Z","dependencies_parsed_at":"2022-09-02T14:10:55.447Z","dependency_job_id":null,"html_url":"https://github.com/phly/PhlyBlog","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phly%2FPhlyBlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phly%2FPhlyBlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phly%2FPhlyBlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phly%2FPhlyBlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phly","download_url":"https://codeload.github.com/phly/PhlyBlog/tar.gz/refs/heads/2.2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251319757,"owners_count":21570451,"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":["hacktoberfest","laminas-mvc"],"created_at":"2024-08-02T11:00:25.773Z","updated_at":"2025-04-28T13:31:49.547Z","avatar_url":"https://github.com/phly.png","language":"PHP","funding_links":[],"categories":["Modules"],"sub_categories":[],"readme":"# PhlyBlog: Static Blog Generator\n\nThis module is a tool for generating a static blog.\n\nBlog posts are simply PHP files that create and return `PhlyBlog\\EntryEntity` objects.\nYou point the compiler at a directory, and it creates a tree of files representing your blog and its feeds.\nThese can either be consumed by your application, or they can be plain old HTML markup files that you serve directly.\n\n## Requirements\n\n- PHP \u003e= `7.3`\n- Laminas packages, notably:\n  - [laminas/laminas-view](https://docs.laminas.dev/laminas-view/), used to render and write generated files.\n  - [laminas/laminas-mvc](https://docs.laminas.dev/laminas-mvc/) and [laminas/laminas-modulemanager](https://docs.laminas.dev/laminas-modulemanager), as this implements a module, and the compiler script depends on it and a laminas-mvc `Application` instance.\n    As such, it also has a dependency on [laminas/laminas-servicemanager](https://docs.laminas.dev/laminas/laminas-servicemanager) and [laminas/laminas-eventmanager](https://docs.laminas.dev/laminas/laminas-eventmanager).\n  - [laminas/laminas-feed](https://docs.laminas.dev/laminas-feed/) for generating feeds.\n  - [laminas/laminas-tag](https://docs.laminas.dev/laminas-tag) for generating tag clouds.\n- [phly/phly-common](https://github.com/phly/PhlyCommon/) for Entity and Filter interfaces.\n\n## Installation\n\nUse [Composer](https://getcomposer.org) to add this module to your application:\n\n```bash\n$ composer require phly/phly-blog\n```\n\n## Writing Entries\n\nFind a location in your repository for entries, preferably outside your document root; I recommend either `data/blog/` or `posts/`.\n\nPost files are simply PHP files that return a `PhlyBlog\\EntryEntity` instance.\nA sample is provided in `misc/sample-post.php`.\nThis post can be copied as a template.\n\nImportant things to note:\n\n- Set the created and/or updated timestamps.\n  Alternately, use `DateTime` or `date()` to generate a timestamp based on a date/time string.\n- Entries marked as \"drafts\" (i.e., `setDraft(true)`) will not be published.\n- Entries marked as private (i.e., `setPublic(false)`) will be published, but will not be aggregated in paginated views or feeds.\n  As such, you need to hand the URL to somebody in order for them to see it.\n- You can set an array of tags.\n  Tags can have whitespace, which will be translated to \"+\" characters.\n\n### Usage\n\nThis module provides [laminas/laminas-cli](https://docs.laminas.dev/laminas-cli/) tooling.\n\nRun:\n\n```bash\n$ ./vendor/bin/laminas help phly-blog:compile\n```\n\nto get usage.\nCurrently, the compilation tooling can generate the following artifacts:\n\n- A file per entry\n- Paginated entry files\n- Paginated entry files by year\n- Paginated entry files by month\n- Paginated entry files by day\n- Paginated entry files by tag\n- Atom and/or RSS feeds for recent entries\n- Atom and/or RSS feeds for recent entries by tag\n- Optionally, a tag cloud\n\nYou will want to setup local configuration; I recommend putting it in\n`config/autoload/blog.global.php`. As a sample:\n\n```php\n\u003c?php\nreturn [\n    'blog' =\u003e [\n        'options' =\u003e [\n            // The following indicate where to write files. Note that this\n            // configuration writes to the \"public/\" directory, which would\n            // create a blog made from static files. For the various\n            // paginated views, \"%d\" is the current page number; \"%s\" is\n            // typically a date string (see below for more information) or tag.\n            'by_day_filename_template'   =\u003e 'public/blog/day/%s-p%d.html',\n            'by_month_filename_template' =\u003e 'public/blog/month/%s-p%d.html',\n            'by_tag_filename_template'   =\u003e 'public/blog/tag/%s-p%d.html',\n            'by_year_filename_template'  =\u003e 'public/blog/year/%s-p%d.html',\n            'entries_filename_template'  =\u003e 'public/blog-p%d.html',\n\n            // In this case, the \"%s\" is the entry ID.\n            'entry_filename_template'    =\u003e 'public/blog/%s.html',\n\n            // For feeds, the final \"%s\" is the feed type -- \"atom\" or \"rss\". In\n            // the case of the tag feed, the initial \"%s\" is the current tag.\n            'feed_filename'              =\u003e 'public/blog-%s.xml',\n            'tag_feed_filename_template' =\u003e 'public/blog/tag/%s-%s.xml',\n\n            // This is the link to a blog post\n            'entry_link_template'        =\u003e '/blog/%s.html',\n\n            // These are the various URL templates for \"paginated\" views. The\n            // \"%d\" in each is the current page number.\n            'entries_url_template'       =\u003e '/blog-p%d.html',\n            // For the year/month/day paginated views, \"%s\" is a string\n            // representing the date. By default, this will be \"YYYY\",\n            // \"YYYY/MM\", and \"YYYY/MM/DD\", respectively.\n            'by_year_url_template'       =\u003e '/blog/year/%s-p%d.html',\n            'by_month_url_template'      =\u003e '/blog/month/%s-p%d.html',\n            'by_day_url_template'        =\u003e '/blog/day/%s-p%d.html',\n\n            // These are the primary templates you will use -- the first is for\n            // paginated lists of entries, the second for individual entries.\n            // There are of course more templates, but these are the only ones\n            // that will be directly referenced and rendered by the compiler.\n            'entries_template'           =\u003e 'phly-blog/list',\n            'entry_template'             =\u003e 'phly-blog/entry',\n\n            // The feed author information is default information to use when\n            // the author of a post is unknown, or is not an AuthorEntity\n            // object (and hence does not contain this information).\n            'feed_author_email'          =\u003e 'you@your.tld',\n            'feed_author_name'           =\u003e \"Your Name Here\",\n            'feed_author_uri'            =\u003e 'http://your.tld',\n            'feed_hostname'              =\u003e 'http://your.tld',\n            'feed_title'                 =\u003e 'Blog Entries :: Your Blog Name',\n            'tag_feed_title_template'    =\u003e 'Tag: %s :: Your Blog Name',\n\n            // If generating a tag cloud, you can specify options for\n            // Laminas\\Tag\\Cloud. The following sets up percentage sizing from\n            // 80-300%\n            'tag_cloud_options'          =\u003e ['tagDecorator' =\u003e [\n                'decorator' =\u003e 'html_tag',\n                'options'   =\u003e [\n                    'fontSizeUnit' =\u003e '%',\n                    'minFontSize'  =\u003e 80,\n                    'maxFontSize'  =\u003e 300,\n                ],\n            ]],\n        ],\n\n        // This is the location where you are keeping your post files (the PHP\n        // files returning `PhlyBlog\\EntryEntity` objects).\n        'posts_path'     =\u003e 'data/posts/',\n\n        // Tag cloud generation is possible, but you likely need to capture\n        // the rendered cloud to inject elsewhere. You can do this with a\n        // callback.\n        // The callback will receive a Laminas\\Tag\\Cloud instance, the View\n        // instance, application configuration // (as an array), and the\n        // application's Locator instance.\n        'cloud_callback' =\u003e ['Application\\Module', 'handleTagCloud'],\n    ],\n\n    'view_manager' =\u003e [\n        // You will likely want to customize the templates provided. Do so by\n        // creating your own in your own module, and make sure you alter the\n        // resolvers so that they point to the override locations. Below, I'm\n        // putting my overrides in my Application module.\n        'template_map' =\u003e [\n            'phly-blog/entry-short'  =\u003e 'module/Application/view/phly-blog/entry-short.phtml',\n            'phly-blog/entry'        =\u003e 'module/Application/view/phly-blog/entry.phtml',\n            'phly-blog/list'         =\u003e 'module/Application/view/phly-blog/list.phtml',\n            'phly-blog/paginator'    =\u003e 'module/Application/view/phly-blog/paginator.phtml',\n            'phly-blog/tags'         =\u003e 'module/Application/view/phly-blog/tags.phtml',\n        ],\n\n        'template_path_stack' =\u003e [\n            'phly-blog' =\u003e 'module/Application/view',\n        ],\n    ],\n];\n```\n\nWhen you run the command line tool, it will generate files in the locations you specify in your configuration.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphly%2FPhlyBlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphly%2FPhlyBlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphly%2FPhlyBlog/lists"}