PHPackages                             comeonfox/phly-blog - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. comeonfox/phly-blog

ActiveLibrary

comeonfox/phly-blog
===================

ZF2 Module implementing a static blog generator

2.0.0beta5(13y ago)07PHPPHP &gt;=5.3.3

Since Jul 13Pushed 13y ago1 watchersCompare

[ Source](https://github.com/comeonfox/PhlyBlog)[ Packagist](https://packagist.org/packages/comeonfox/phly-blog)[ Docs](https://github.com/weierophinney/PhlyBlog)[ RSS](/packages/comeonfox-phly-blog/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

PhlyBlog: Static Blog Generator
===============================

[](#phlyblog-static-blog-generator)

This module is a tool for generating a static blog.

Blog posts are simply PHP files that create and return `PhlyBlog\EntryEntity`objects. You point the compiler at a directory, and it creates a tree of files representing your blog and its feeds. These can either be consumed by your application, or they can be plain old HTML markup files that you serve directly.

Requirements
------------

[](#requirements)

- PHP &gt;= 5.3.3
- Zend Framework 2 &gt;= 2.0.0beta4, specifically:
    - Zend\\View\\View, used to render and write generated files
    - Zend\\Mvc and Zend\\ModuleManager, as this implements a module, and the compiler script depends on it and an Application instance. As such, it also has a dependency on Zend\\Loader, Zend\\ServiceManager, and Zend\\EventManager.
    - Zend\\Feed\\Writer
    - Zend\\Tag\\Cloud
- PhlyCommon (for Entity and Filter interfaces)

Installation
------------

[](#installation)

You can add this module as a git submodule to your repository. Alternately, use composer. To do so, add the following `composer.json` configuration in your project:

```
{
    "minimum-stability": "dev",
    "require": {
        "phly/phly-blog": "dev-master"
    }
}
```

and then execute:

```
php composer.phar install
```

Writing Entries
---------------

[](#writing-entries)

Find a location in your repository for entries, preferably outside your document root; I recommend either `data/blog/` or `posts/`.

Post files are simply PHP files that return a `PhlyBlog\EntryEntity` instance. A sample is provided in `misc/sample-post.php`. This post can be copied as a template.

Important things to note:

- Set the created and/or updated timestamps. Alternately, use `DateTime` or `date()` to generate a timestamp based on a date/time string.
- Entries marked as "drafts" (i.e., `setDraft(true)`) will not be published.
- Entries marked as private (i.e., `setPublic(false)`) will be published, but will not be aggregated in paginated views or feeds. As such, you need to hand the URL to somebody in order for them to see it.
- You can set an array of tags. Tags can have whitespace, which will be translated to "+" characters.

Usage
=====

[](#usage)

This module is ZF2 Console-aware. Once installed and active in your application, you should be able to run:

```
% php public/index.php
```

and see usage for the module. Currently, it defines a "blog compile" action that can generate the following artifacts:

- A file per entry
- Paginated entry files
- Paginated entry files by year
- Paginated entry files by month
- Paginated entry files by day
- Paginated entry files by tag
- Atom and/or RSS feeds for recent entries
- Atom and/or RSS feeds for recent entries by tag
- Optionally, a tag cloud

You will want to setup local configuration; I recommend putting it in `config/autoload/module.blog.config.global.php`. As a sample:

```
```php
