定制 sly/bloghub 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

sly/bloghub

Composer 安装命令:

composer require sly/bloghub

包简介

Use a Git repository to generate blog entities and contents. PlainText, HTML and Markdown formats supported.

README 文档

README

Use a Git repository to generate blog entities and contents.

=====

WORK IN PROGRESS.

=====

Requirements

  • PHP 5.3+

Installation

Add to your project Composer packages

Just add sly/blog-hub package to the requirements of your Composer JSON configuration file, and run php composer.phar install to install it.

Install from GitHub

Clone this library from Git with git clone https://github.com/Ph3nol/BlogHub.git.

Goto to the library directory, get Composer phar package and install vendors:

curl -s https://getcomposer.org/installer | php
php composer.phar install

You're ready to go.

Repository structure

Your git repository has to respect a Categories/Posts structure to be understood by the library.

The logic:

Category 1
   `-- Title of my post 1
   `-- Title of my post 2
   `-- Title of my post 3

Category 2
   `-- Title of my post 4

To match this logic, the repository tree will be:

Category 1/
Category 1/Title of my post 1.md
Category 1/Title of my post 2.md
Category 1/Title of my post 3.md
Category 2/
Category 2/Title of my post 4.md

Post structure

Each post has to be a markdown file, into a category folder. Informations can be added to it as PHPDoc/Annotations one. Here is an example:

/**
 * @createdAt 2013-01-01
 * @description This is my post description.
 * @tags tag1, tag2, tag3
 * @format markdown
 */

# My post title

My post content.

Example

require_once 'vendor/autoload.php';

use GitElephant\Repository;
use Sly\BlogHub\Blog\Blog;

/**
 * GitElephant repository instance.
 */
$repo = new Repository('/path/to/your/repository');
$repo->checkout('master');

/**
 * BlogHub instance, with repository object as argument.
 */
$blog = new Blog($repo);

Categories list

foreach ($blog->getCategories() as $category) {
    // Your logic
}

Elements:

  • Category name: (string) $category or $category->getName()
  • Posts collection: $category->getPosts()
  • Number of posts: $category->getPosts()->count()

Posts list

foreach ($blog->getPosts() as $post) {
    // Your logic
}
foreach ($category->getPosts() as $post) {
    // Your logic
}

Elements:

  • Post title: (string) $post or $post->getTitle()
  • Post category object: $post->getCategory()
  • Slug: $post->getSlug()
  • Excerpt: $post->getExcerpt([string $separator = ' [...]'])
  • Tags collection: $post->getTags()
  • Creation DateTime: $post->getCreatedAt()
  • Update DateTime: $post->getUpdatedAt()

Tags list

foreach ($blog->getTags() as $tag) {
    // Your logic
}
foreach ($post->getTags() as $tag) {
    // Your logic
}

Elements:

  • Tag name: (string) $tag or $tag->getName()

Query Builder

You can use the QueryBuilder to retreive a specific model entity. Here is an example:

$query = $blog->getQuery(); // Get QueryBuilder from Blog Manager service
$post  = $query->from('Post')->getOneBySlug('hello-world'); // Get the Post from its slug

sly/bloghub 适用场景与选型建议

sly/bloghub 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 3, 最近一次更新时间为 2013 年 01 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「blog」 「git」 「markdown」 「repository」 「html」 「content」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-01-06