dragonee/php-silverplate
Composer 安装命令:
composer require dragonee/php-silverplate
包简介
A minimal stack for creating static HTML/Markdown websites.
README 文档
README
Forget to include header.php and footer.php anymore.
PHP Silverplate serves your static content on a silver platter. It does not matter if you need to write simple, one-page website, or a whole book - PHP Silverplate accepts any HTML or Markdown file and displays it inside a predetermined layout file. Pretty URLs and HTML5 Boilerplate included.
Quickstart Guide
Use Composer to download the stable version:
$ curl -s https://getcomposer.org/installer | php
$ php composer.phar create-project dragonee/php-silverplate
Make your changes in the index.php file. Add necessary style
declarations to the css/main.css. Then access the main directory of PHP Silverplate
installation with your web browser.
Features
- single
layout.phpfile for the whole website (with an ability to specify layout file on a per-file basis). - file formats:
.phpfor HTML/PHP files,.mdfor Markdown,.redirfor redirects to other URLs. - Markdown files are parsed by excellent PHP Markdown library: http://michelf.ca/projects/php-markdown/
- pretty URL rewriting with
.htaccess - simple structure - place
text.phpin the website directory and access it via theexample.com/text/address. - nested directories are also supported.
- single
404.phpfile for your convenience. - HTML5 Boilerplate v4.0.2 - you can go straight to the business.
Usage
When an user navigates to the arbitrary URI, for example /example,
app.php begins to search for corresponding file in the following order:
- At first, it checks for an directory named
example. If such directory exists,app.phpsets its URI internally to/example/indexand resets the search. - Next, a file with the name
example.mdis looked up. If it exists, it is parsed as Markdown file and rendered in thelayout.phpfile. - Next, a file with the name
example.phpis looked up. If it exists, it is treated as the PHP file and rendered in thelayout.phpfile. - Next, a file with the name
example.rediris looked up. If it exists, the script returns 302 Found response and redirects to the link specified in the contents of the .redir file. - If no file is found,
404.phpis displayed and the application responds with 404 Page Not Found response.404.phpis rendered independently from the layout file.
app.php is completely transparent and relies on the filesystem to find
files. That means you are able to structure your files in subdirectories
any way you want.
app.php does not allow accessing files that are outside the directory
app.php is located in. This also affects symbolic links.
Blocks
You can provide blocks in the layout file that can be overwritten by
data specified in the content file. The most common use case is to
provide the <title> tag of the document.
In order to define a block, put a get() function in the layout file:
<title><?php echo get('title', 'Default Title') ?></title>
You can override the default value of the title block by setting it in the content file:
<?php meta('title', 'Another page') ?>
Or in the Markdown file:
Meta title: Another page
In PHP content files you can also open() and close() multiline blocks:
<?php open('javascripts') ?>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery.plugin.js"></script>
[...]
<?php close('javascripts') ?>
Currently Markdown files do not have any support for the opening and closing blocks.
Custom Layouts
In order to specify custom layout file for a content file, fill a layout block:
<?php meta('layout', 'my_layout') ?>
or:
Meta layout: my_layout
Make sure, that the my_layout.php file is present before using it.
Relative URLs
With the release of v0.8.1, PHP Silverplate gives you a way to write paths in your layout and content files in a relative maneer to the application root directory.
- Use
path://some-image.pngin your Markdown files. - Use
App::path('some-image.png')in your PHP files.
Design
You can style your files differently based on their type. app.php
provides your layout.php file with two different classes:
.php-filefor PHP files..md-filefor Markdown files.
These classes can help you distinguish between styles specific for your Markdown document layouts and between your PHP layouts.
The layout.php provided in this distribution also defines the classes
block, which can be used to build some conditional CSS styles for some
files on your website.
dragonee/php-silverplate 适用场景与选型建议
dragonee/php-silverplate 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 47 次下载、GitHub Stars 达 14, 最近一次更新时间为 2013 年 01 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「markdown」 「html」 「static」 「silverplate」 「website」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dragonee/php-silverplate 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dragonee/php-silverplate 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dragonee/php-silverplate 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Bookdown.io With Bootswatch Styles And Prism Syntax Highlighting
TwigStan is a static analyzer for Twig templates powered by PHPStan
Adds more BBCode
HTML and form generation
A modern HTML DOM parser for PHP using DOMDocument and Symfony CssSelector.
统计信息
- 总下载量: 47
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-01-01