{"id":16674427,"url":"https://github.com/settermjd/markdown-blog","last_synced_at":"2025-04-07T23:34:23.286Z","repository":{"id":131568659,"uuid":"444405696","full_name":"settermjd/markdown-blog","owner":"settermjd","description":"A small package that will convert Markdown files with YAML frontmatter into a list of blog item objects.","archived":false,"fork":false,"pushed_at":"2024-08-20T12:20:21.000Z","size":292,"stargazers_count":1,"open_issues_count":9,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-14T00:51:37.618Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/settermjd.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-01-04T12:10:48.000Z","updated_at":"2024-08-20T12:18:51.000Z","dependencies_parsed_at":"2024-10-31T10:41:16.141Z","dependency_job_id":null,"html_url":"https://github.com/settermjd/markdown-blog","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settermjd%2Fmarkdown-blog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settermjd%2Fmarkdown-blog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settermjd%2Fmarkdown-blog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settermjd%2Fmarkdown-blog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/settermjd","download_url":"https://codeload.github.com/settermjd/markdown-blog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247749893,"owners_count":20989709,"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":[],"created_at":"2024-10-12T12:43:11.712Z","updated_at":"2025-04-07T23:34:23.243Z","avatar_url":"https://github.com/settermjd.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Markdown Blog\n\nThis is a Markdown-based blog module, one that does just the basics of converting a series of, minimalist, Markdown files with Yaml front-matter into an array of BlogArticle entities. \nThese entities can be used to provide a list of blog articles, or to render a given article.\n\n## Usage\n\n### Use standalone\n\nThe code can be used standalone or as part of code in larger, likely framework-based, setup.\n\nIf you want to use the code standalone, you need to first create a series of Markdown files that have YAML front-matter. \nThen, you can use the code below as a starting point, to convert the Markdown files into BlogArticle entities, which you can then paginate over or render individually using the templating engine of choice (if you are using one).\n\n```php\nrequire_once '../vendor/autoload.php';\n\n$itemLister = new \\MarkdownBlog\\Items\\Adapter\\ItemListerFilesystem(\n    __DIR__ . '/../data/posts',\n    new \\Mni\\FrontYAML\\Parser()\n);\n\n/** @var \\MarkdownBlog\\Entity\\BlogArticle $item */\n$items = $itemLister-\u003egetArticles();\n```\n\n### Use as part of a framework\n\nIf you are using the code as part of a framework, ideally one that implements [PSR-11](https://www.php-fig.org/psr/psr-11/), such as Mezzio, then you can take a slightly different approach.\n\nIn this case, first add a configuration entry to your application's configuration that has the following structure.\n\n```php\nuse Mni\\FrontYAML\\Parser;\n\nreturn [\n    'blog' =\u003e [\n        'type' =\u003e 'filesystem',\n        'path' =\u003e __DIR__ . '/../../data/posts',\n        'parser' =\u003e new Parser(),\n    ]\n];\n```\n\nThen, in your DI container, add an entry where the key is `ItemListerInterface::class` and the value is `ItemListerFactory`. \nThe example below shows how to do this when using Mezzio.\n\n```php\n'factories'  =\u003e [\n    \\MarkdownBlog\\Items\\ItemListerInterface::class =\u003e \\MarkdownBlog\\Items\\ItemListerFactory::class,\n]\n```\n\nThis will then instantiate an `ItemListerInterface` object, based on your configuration and make it available to your application, when retrieved.\n\nThen, use it as in the standalone version above, such as in the example below.\n\n```php\n/** @var \\MarkdownBlog\\Entity\\BlogArticle $item */\n$items = $itemLister-\u003egetArticles();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsettermjd%2Fmarkdown-blog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsettermjd%2Fmarkdown-blog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsettermjd%2Fmarkdown-blog/lists"}