bugkiwi / san-ssr-target-php

San SSR code generation targiting PHP

Home Page:https://searchfe.github.io/san-ssr-target-php/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

san-ssr-target-php

npm version downloads Build Status Coveralls dependencies semantic-release GitHub issues David David Dev DUB license Commitizen friendly

Install

Supported Environment

  • PHP 5 >= 5.3.0, PHP 7
npm i san san-ssr san-ssr-target-php

Note: ts2php requires a specific external TypeScript, you'll need npm i typescript@3.4, see searchfe/ts2php/issues/93.

CLI Usage

Command line interface:

san-ssr --target php --compile '{"nsPrefix":"demo\\"}' ./component.ts > ssr.php

Programmatic Interface

Pass 'php' as the second parameter of SanProject [SanProject#compile(filepath, target, options)][.compile()] method.

TypeScript:

import { Target, SanProject } from 'san-project'
import { writeFileSync } from 'fs'

const project = new SanProject()
const targetCode = project.compile('src/component.ts', 'php')

writeFileSync('ssr.php', targetCode)

Or in JavaScript:

const { SanProject } = require('san-project')
import { writeFileSync } from 'fs'

const project = new SanProject()
const targetCode = project.compile('src/component.ts', 'php')

writeFileSync('ssr.php', targetCode)

Known Issues

THIS SECTION IS FOR MAINTAINERS ONLY

  • noDataOutput 控制的数据输出中,对象序列化使用 json_encode 实现,属性顺序和 JavaScript 中可能不同

Contribution Guide

Development Prerequisites:

Install dependencies and run tests:

npm install
composer install
npm test

Debug a single case (e.g. test/cases/array-literal):

./bin/debug array-literal

source ./bin/auto-complete to make zsh to auto complete test case names.

About

San SSR code generation targiting PHP

https://searchfe.github.io/san-ssr-target-php/


Languages

Language:TypeScript 50.3%Language:JavaScript 23.2%Language:PHP 17.6%Language:HTML 8.0%Language:Smarty 0.8%