承接 rockstarcode/markdb 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rockstarcode/markdb

Composer 安装命令:

composer require rockstarcode/markdb

包简介

Markdown flat file database

README 文档

README

Build Status Latest Stable Version Total Downloads Latest Unstable Version Daily Downloads

MarkDB - MarkDown Database for Blogs/CMSs

MarkDB is an engine that allows you to use MarkDown + Yaml files as data points for your CMS or Blog.

The intent is allow you to separate content creation from the platform which controls your application design. This allows you to write your blog or project in any method you'd like and attach content as if it were database driven.

This project stemmed from my blog at RockstarCode where I didnt want to have to design my site via a CMS like OctoberCMS or Wordpress which would force me to write posts via their interface, nor did I want to store content in a database which needed to be sync'd.

The solution I chose was to create a flat file .git repo to house my articles and MarkDB was the interface to collect and manage posts.

This allows me to write posts and preview them locally before pushing them to different environments by simple git push.

Features

  • Pretty URL slug to identify files or directories
  • Customize settings per file/directory
  • Use a git repo to version control your data points
  • Simple search for articles via attributes
  • [FUTURE] - caching

Libraries vs Articles

MarkDB will look for files and directories given a $base path

From there it will provide a list of Libraries (directories) and Articles (Files)

Libraries hold collections of child libraries and all child articles to allow you to loop thru if needed to create navigation. For example you may have a base blog with navigation on various topics [Rants, Tutorials, Personal Thoughts] Your base new MarkDB('/path/to/blog/data') would house 3 libraries Rants, Tutorials, Personal Thoughts which you can use to pull unique data from or link to

Articles house file information in both YAML & MarkDown which you can use to customize data and presentation.

    ---
    title: Article Title
    author: Authr Name
    author_email: Author@Email.com
    authdeck: author.name
    ---
    ### Hello World
    
    This is my article

Everything between --- will be processed as yaml, below the second --- will be processed as markdown

Requirements

  • LibYaml & pecl yaml for PHP Updated to symfony/yaml to remove dependency
  • Carbon for data time

Installation

    composer require "rockstarcode/markdb:dev-master"

Usage

$MarkDb = new MarkDB\MarkDB('/path/to/files/','base/path/to/form/relative/slugs');

$slug = 'path/to/some/article'; 

$article = $MarkDb->get($slug); # (object) Article 
   
   $article->slug           # url friendly path that identifies article in MarkDB
   $article->{$property}    # properties extracted from YAML processing of the article
   $article->content()      # processed MarkDown of content of article
   $article->read_time()    # helper to calculate words in article and average read time
   $article->summary()      # Extract certain percentage of content for preview 

$find = $MarkDb->where(['author'=>'Author Name','category'=>'Books Ive Read']);  (Array)[Articles]

foreach($MarkDb->libraries as $library){
     $library->articles     # list of articles within library
     $library->libraries    # list of child libraries
     $library->index        # list of all libraries/articles by slug
     $library->slug         # slug which identifies library
     
}

Laravel

MarkDB comes with a Laravel 5.* Service Provider which will add MarkDB as a facade to your application

# .env
MARKDB_PATH=/path/to/blog-cms

# config/app.php
    
    'providers'=>[
        ...
        \MarkDb\Support\Laravel\MarkDBServiceProvider::class,
    ],
    
    'aliases' => [
        ...
        'MarkDb' => \MarkDB\Support\Laravel\MarkDBFacade::class,
    ]

a sample route to see articles in Laravel :

#routes.php
  Route::get('/posts, ['as'=>'posts','uses'=>function($slug){
          
          $markdb= app()->make('markdb');
          
          $articles = $cms->articles( /*optional*/ ['page'=>1, 'limit'=>10]);
           
          return view('index',['articles'=>$articles]); 
           
    }])->where('slug','(.*)');
    
  Route::get('/posts/{slug}', ['as'=>'post','uses'=>function($slug){
        
        $article = \MarkDB::get($slug);
         
        return view('article',['article'=>$article]); 
         
  }])->where('slug','(.*)');

Tutorial

I created a simple Lumen + MarkDB tutorial which steps you thru basic usage

RockstarCode - Lumen + MarkDB

License

Released under MIT license, feel free to use, modify, contribute changes.

rockstarcode/markdb 适用场景与选型建议

rockstarcode/markdb 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 284 次下载、GitHub Stars 达 9, 最近一次更新时间为 2015 年 10 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 rockstarcode/markdb 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 rockstarcode/markdb 我们能提供哪些服务?
定制开发 / 二次开发

基于 rockstarcode/markdb 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 284
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-27