定制 crodas/artifex 二次开发

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

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

crodas/artifex

Composer 安装命令:

composer require crodas/artifex

包简介

Macros on steroids. The easiest way of generating code.

README 文档

README

Artifex is a pre-processor for PHP. It aims to generate PHP code in a very simple and intuitive way.

Syntax

Artifex syntax is heavily inspired by C preprocessors, but instead of starting with # (which is a comment in PHP), they starts with #*

#* $foo = $foo + 1

Artifex also support multiline in a convinient way.

#*
# $foo = $foo + 2
# $bar = $foo + $foo->xxx();

In order to replace a value, it must be surrounded by __, for instance:

<?php
#* $foo = rand()
function getRandomOnce() {
  return __foo__;
}

#* $foo = {'foo': 'bar'}
function getArray() {
  return __@foo__;
}

The syntax is heavily inspired by PHP, although there are some differences:

  1. The semicolon is not needed (they are optional).
  2. Any string which is not assigned will be printed out. #* "hello there" is equal to #* print("hello there")
  3. Curly Brackets are not valid, instead there is a generic end token to tell where a block ends
  4. Variables that are prepend with a @ caracter means that we want to representate its value (same as calling var_exports).
  5. It supports json.

Iterators

So far Artifex support foreach

<?php

class __foo__ {
  #* foreach(['foo', 'bar'] as $id => $name)
  function get__name__() {
    return "I'm a the getter of __id__ => __name__";
  }
  #* end
}

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2012-06-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固