定制 phpillip/phpillip 二次开发

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

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

phpillip/phpillip

最新稳定版本:v1.0.5

Composer 安装命令:

composer require phpillip/phpillip

包简介

PHP Static Site Generator

README 文档

README

Phpillip is Hugo's cousin.

What

Phpillip is static website generator written in PHP and powered by Silex and Symfony components.

It basically dumps your Silex application to static HTML files in a /dist folder.

The result directory is meant to be served by an HTTP Server like apache and nginx or published to static website services like Github Pages.

It's particularly fit for blogging, documentation and showcase.

How

Phpillip is a Silex application.

The build process:

  • Loop through all declared routes in the Application
  • Load content associated with the route (if any) from file
  • Call each route with its content in a Request
  • Dump the Response content in a file

It supports as many format as you need.

It uses the powerful Twig engine for templating.

Why

Phpillip is meant to be:

  • Highly extensible
  • Friendly with Symfony developers
  • Clear, simple and clean

Getting started

Get your static website:

  1. Bootstrap a Phpillip project
  2. Write your content
  3. Declare your routes and controllers
  4. Provide templates
  5. Build the static website

1. Bootstrap

To bootstrap a new Phpillip project:

composer create-project phpillip/phpillip-standard my_app
cd my_app

2. Write content

Write your content file [my-content-slug].[format] in src/Resources/data/[my-content-type]/:

Example src/Resources/data/article/why-use-phpillip.md:

---
title: Why use Phpillip?
---

# Why use Phpillip

Why not!

3. Declare routes and controllers

Phpillip is a Silex application, so you can declare a route and its controller the same way you would in Silex:

A closure:

$this->get('/', function () { return []; })->template('index.html.twig');

Your own controller class in 'src/Controller':

$this->get('/blog', 'Controller\\BlogController::index');

A controller service (here the Phpillip content controller service):

$this->get('/blog/{post}', 'content.controller:show')->content('post');

Phpillip gives you many helpers to automate content loading for your routes.

4. Provide templates

Write the Twig templates corresponding to your routes and controllers in src/Resources/views/

If you use the default Phpillip routes and controller, you'll need to provide:

The list template:

  • File: [my-content-type]/index.html.twig.
  • Variables: An array of contents, named [content-type]s.
{% extends 'base.html.twig' %}
{% block content %}
    {% for article in articles %}
        <a href="{{ path('article', {article: article.slug}) }}">
            {{ article.title }}
        </a>
    {% endfor %}
{% endblock %}

The single content page template:

  • File: [my-content-type]/show.html.twig.
  • Variables: The content as an associative array, named [content-type].
{% extends 'base.html.twig' %}
{% block content %}
    {{ article.content }}
{% endblock %}

5. Build

Build the static files to /dist with the Phpillip build command:

bin/console phpillip:build

You're done!

Going further:

About Phpillip's features:

About content:

About controllers:

About the console:

Contribution

Any kind of contribution is very welcome!

Directory structure

# Sources directory
src/
    # Your Silex Application in which your declare routes, services, ...
    Application.php

    # Your controller classes (optional)
    # This is only a recommandation, you can put controllers wherever you like
    /Controller
        MyController.php

    # Resources
    /Resources

        # Configuration files directory
        config/
            # Phpillip configuration
            config.yml

        # Content directory
        data/
            # Create a directory for each content type
            post/
                # Your 'post' contents goes here
                my-first-post.md
                a-post-in-json.json

        # Public directory
        public/
            # All public directory content will be exposed in 'dist'
            css/
                style.css

        # Views directory
        views/
            # Your twig templates
            base.html.twig
            blog/
                index.html.twig
                show.html.twig

# Destination directory
dist/
    # The static files will be dumped in here

phpillip/phpillip 适用场景与选型建议

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 26
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

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