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: about 1 month 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 (over 1 year ago)
- Default Branch: develop
- Last Pushed: 2025-01-02T07:11:00.000Z (5 months ago)
- Last Synced: 2025-04-11T23:52:44.767Z (about 1 month ago)
- Topics: codeigniter, codeigniter4, markdown, php, php81
- Language: PHP
- Homepage: https://michalsn.github.io/codeigniter-markdown-pages/
- Size: 677 KB
- Stars: 10
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeIgniter Markdown Pages
Markdown based pages for the CodeIgniter 4 framework.
[](https://github.com/michalsn/codeigniter-markdown-pages/actions/workflows/phpunit.yml)
[](https://github.com/michalsn/codeigniter-markdown-pages/actions/workflows/phpstan.yml)
[](https://github.com/michalsn/codeigniter-markdown-pages/actions/workflows/deptrac.yml)
[](https://coveralls.io/github/michalsn/codeigniter-markdown-pages?branch=develop)
## 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 $file->parse()->getContent();
// prints: parsed markdown from a fileecho $file->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/