定制 apex/syrus 二次开发

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

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

apex/syrus

Composer 安装命令:

composer require apex/syrus

包简介

Light-weight, extensible template engine.

README 文档

README

A light weight, extensible template engine designed with separation of duties in mind, allowing both back-end developers and designers to complete their work independently. It supports:

  • Standardized <s:...) template tags providing short hand for larger HTML snippets, interopability across themes, plus additional PHP functionality.
  • Easily develop your own functional <s:...> template tags in addition to default set.
  • Easy loading of dynamic content such as breadcrumbs, social media links, and placeholders.
  • Multiple themes based on template file location (eg. different themes for public site, admin panel, and client area).
  • PSR6 caching, including configuration for no-cache pages and tags, and support for optional "cache" attribute within tags.
  • Optional auto-routing, automatically renders the appropriate template corresponding to the URI being viewed.
  • Optional per-template PHP class, which is automatically executed upon rendering the template providing bridge between templates and back-end application.
  • Developed with designers in mind, allowing them to work independently and without the need to navigate back-end software code.
  • Built-in support for Cluster, which makes an RPC call for every template rendered providing support for horizontal scaling including parameter based routing.
  • Optional built-in support for Apex Debugger to gather debugging information on templates rendered.

Installation

Install via Composer with:

composer require apex/syrus

Table of Contents

  1. Designers
    1. Getting Started
    2. File / Directory Structure
      1. Theme Structure
      2. Body Content Pages
      3. Public Assets
    3. Yield / Var Tags
    4. Variables, foreach, and if / else Tags
    5. <s:...> Template Tags
    6. Using Multiple Themes
  2. Developers
    1. Syrus class / Container Definitions
      1. site.yml Configuration File
    2. Render Templates
      1. Auto-Routing
      2. Executing Per Template PHP Files
      3. Utilizing RPC Calls
    3. Variables, Blocks and Callouts
    4. Content Loader (breadcrumbs, social media links, placeholders)
    5. Creating New <s...> Functional Tags
    6. StackElement Object
    7. Dummy Data for Designers
    8. Caching

Local Server

Get Syrus up and running with the default web site by running the following command within the ~/public/ directory:

php -S 127.0.0.1:8180

The default site including tag examples will now be available at http://127.0.0.1:8180/. Alternatively, if you have docker-compose installed you may achieve the same by running the following command:

sudo docker-compose up -d

Basic Usage

use Apex\Syrus\Syrus;

// Start
$syrus = new Syrus();

// Assign some variables
$syrus->assign('name', 'value');

// Assign array
$location = [
    'city' => 'Toronto', 
    'province' => 'Ontario', 
    'country' => 'Canada'
];
$syrus->assign('loc', $location);

// Add foreach blocks
$syrus->addBlock('users', ['username' => 'jsmith', 'email' => 'jsmith@domain.com']);
$syrus->addBlock('users', ['username' => 'mike', 'email' => 'mike@domain.com']);

// ADd error callout
$this->addCallout('Uh oh, there was a problem.', 'error');

// Render template
echo $syrus->render('contact.html');

// Or, use auto-routing and render template based on URI being viewed.
echo $syrus->render();

Support

If you have any questions, issues or feedback for Syrus, please feel free to drop a note on the ApexPl Reddit sub for a prompt and helpful response.

Follow Apex

Loads of good things coming in the near future including new quality open source packages, more advanced articles / tutorials that go over down to earth useful topics, et al. Stay informed by joining the mailing list on our web site, or follow along on Twitter at @mdizak1.

apex/syrus 适用场景与选型建议

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-26