Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michalsn/codeigniter-markdown-pages
Easily work with markdown based files in CodeIgniter 4
https://github.com/michalsn/codeigniter-markdown-pages
codeigniter codeigniter4 markdown php php81
Last synced: 3 months ago
JSON representation
Easily work with markdown based files in CodeIgniter 4
- Host: GitHub
- URL: https://github.com/michalsn/codeigniter-markdown-pages
- Owner: michalsn
- License: mit
- Created: 2023-11-10T16:26:20.000Z (about 1 year ago)
- Default Branch: develop
- Last Pushed: 2024-01-18T01:20:22.000Z (12 months ago)
- Last Synced: 2024-10-01T00:41:08.872Z (3 months ago)
- Topics: codeigniter, codeigniter4, markdown, php, php81
- Language: PHP
- Homepage: https://michalsn.github.io/codeigniter-markdown-pages/
- Size: 450 KB
- Stars: 8
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeIgniter Markdown Pages
Markdown based pages for the CodeIgniter 4 framework.
[![PHPUnit](https://github.com/michalsn/codeigniter-markdown-pages/actions/workflows/phpunit.yml/badge.svg)](https://github.com/michalsn/codeigniter-markdown-pages/actions/workflows/phpunit.yml)
[![PHPStan](https://github.com/michalsn/codeigniter-markdown-pages/actions/workflows/phpstan.yml/badge.svg)](https://github.com/michalsn/codeigniter-markdown-pages/actions/workflows/phpstan.yml)
[![Deptrac](https://github.com/michalsn/codeigniter-markdown-pages/actions/workflows/deptrac.yml/badge.svg)](https://github.com/michalsn/codeigniter-markdown-pages/actions/workflows/deptrac.yml)
[![Coverage Status](https://coveralls.io/repos/github/michalsn/codeigniter-markdown-pages/badge.svg?branch=develop)](https://coveralls.io/github/michalsn/codeigniter-markdown-pages?branch=develop)![PHP](https://img.shields.io/badge/PHP-%5E8.1-blue)
![CodeIgniter](https://img.shields.io/badge/CodeIgniter-%5E4.3-blue)## Installation
composer require michalsn/codeigniter-markdown-pages
## Basic usage
To easily demonstrate how the things are working we will assume for a moment that this is our folder structure.
```bash
├── app
├── content
│ ├── 1_quick-start
│ │ ├── 1_installation.md
│ │ ├── 2_database-migration.md
│ │ ├── what-next.md
│ │ └── subfolder
│ │ └── one-file.md
│ └── first-steps
│ ├── available-methods.md
│ └── how-to-use-this.md
├── public
├── tests
├── vendor
└── writable
```Now we have to initialize Markdown Pages with our folder:
```php
$markdownPages = services('markdownpages', ROOTPATH . 'content');$dir = $markdownPages->dirs()->first();
echo $dir->getName()
// prints: Quick Startecho $dir->getSlug()
// prints: quick-startforeach($dir->getFiles()->items() as $file) {
echo $file->getName();
// prints: Installationecho $file->getSlug();
// prints: installationecho $file->getPath();
// prints: quick-start/installationecho $content->parse()->getContent();
// prints: parsed markdown from fileecho $content->parse()->getMeta();
// prints: parsed YAML as key -> value
}
```We use [Collection](https://github.com/lonnieezell/myth-collection) class pretty much everywhere so please get familiar with it to use this package comfortably.
## Docs
https://michalsn.github.io/codeigniter-markdown-pages/