macrominds/website-lib 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

macrominds/website-lib

Composer 安装命令:

composer require macrominds/website-lib

包简介

Library for simple Websites based on plain Markdown files with YAML frontmatter

README 文档

README

Use this simple framework to create websites with:

The framework is designed with flexibility in mind, so that it might support other templating engines, meta data and content languages later on. The idea is to be able to replace YAML with json, Markdown with Asciidoctor, Twig with blade and so on.

See the Documentation for setup, usage and customization.

Extending and customization

You can replace the default services (see \Macrominds\AppServiceProvider).

You do this by binding either singletons or multi object factories to the container. This way, you can override the settings or add new bindings.

use Macrominds\App;
use Macrominds\Processing\TemplateEngine\TemplateEngine;
use Symfony\Component\HttpFoundation\Request;

$app = new App(realpath(__DIR__ . '/..'));
$app->getContainer()->singleton(
    TemplateEngine::class,
    function(): TemplateEngine {
        return new MyVeryOwnTemplateEngine();
    }
);
$app->getContainer()->factoryObject(
    Request::class,
    function(): Request {
        return new MyCustomizedRequest(/*…*/);
    }
);

$app->getContainer()->resolve(Request::class)->myCustomRequestMethod();

An example usage is to manually debug a certain Request:

use Macrominds\App;
use Symfony\Component\HttpFoundation\Request;

$app = new App(realpath(__DIR__ . '/..'));

// …

// always request /404.html
$app->getContainer()->factoryObject(Request::class, function() {
    return Request::create('/404.html');
});

Testing this project

Run ./vendor/bin/phpunit to run the tests.

To create a code coverage report, run ./code-coverage-report.sh. You can then visit report/coverage/index.html to view the report.

Automatic testing and docker images

This project provides a .gitlab-ci.yml and thus uses GitLab CI/CD.

The docker images inherit macrominds/app php.df. Both docker files use build args for composer- and php versions.

To build the docker images locally:

$ ./ci.bash build-all-local

Run phpunit inside the container:

$ docker run -it --rm -v $(pwd):/var/www/html macrominds/website-lib:php73 vendor/bin/phpunit
$ docker run -it --rm -v $(pwd):/var/www/html macrominds/website-lib:php74 vendor/bin/phpunit
$ docker run -it --rm -v $(pwd):/var/www/html macrominds/website-lib:php80 vendor/bin/phpunit

Build and publish the images for gitlab CI (also see gitlab docs):

$ ./ci.bash build-all-remotes-and-publish

Code quality

Measure the current code quality with phpmetrics:

$ ./phpmetrics-report.sh

TODO

  • Support symfony routes for more sophisticated websites and add individual resource route dynamically when it is requested
  • Instead of using <div class="block" markdown="1"> for blocks, it would be better if we would just allow multiple markdown sections in a content file (for example separated by ---)
  • See if we can get rid of the standard IntlExtension in Macrominds\TemplateEngine\Builder and make it optional. It requires "ext-intl" and is not needed for every website.
  • Observe the lack of activity at erusev/parsedown and erusev/parsedown-extra and decide if we should switch to another lib. thephpleague/commonmark looks like a promising alternative.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: ISC
  • 更新时间: 2019-11-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固