Skip to content

Commit

Permalink
docs(compilers): add docs for php
Browse files Browse the repository at this point in the history
  • Loading branch information
hatemhosny committed Oct 14, 2023
1 parent 54f6223 commit 7a23ce8
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 3 deletions.
3 changes: 1 addition & 2 deletions docs/docs/languages/php-wasm.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# PHP (Wasm)

import RunInLiveCodes from '../../src/components/RunInLiveCodes.tsx';
import LiveCodes from '../../src/components/LiveCodes.tsx';

PHP in Browser, powered by WebAssembly (using [php-wasm](https://github.com/seanmorris/php-wasm)).
Expand Down Expand Up @@ -66,7 +65,7 @@ Check the [starter template](#example-usage) for another example.

### Version

`php-wasm` v0.0.7, running Python v8.2.4
`php-wasm` v0.0.7, running PHP v8.2.4

## Code Formatting

Expand Down
59 changes: 58 additions & 1 deletion docs/docs/languages/php.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,60 @@
# PHP

TODO...
import LiveCodes from '../../src/components/LiveCodes.tsx';

PHP running client-side in the browser using [Uniter](https://phptojs.com/).

Uniter is a light-weight PHP-to-JavaScript transpiler and runtime with JavaScript interoperability and client-side DOM manipulation. However, only a small subset of PHP's standard library is supported.

:::info Note

If you need better standard library support, you may want to use [`php-wasm`](./php-wasm.md).

`php-wasm` runs PHP in the browser using WebAssembly. This matches the behavior of the official PHP interpreter and allows using PHP's standard library. However, it requires relatively large download and has limited capabilities for client-side DOM manipulation.

:::

## Usage

### JavaScript Interoperability

Example:

<LiveCodes template="php" height="80vh"></LiveCodes>

## Language Info

### Name

`php`

### Extension

`.php`

### Editor

`script`

## Compiler

[Uniter](https://phptojs.com/)

### Version

Uniter v2.18.0

## Code Formatting

Using [prettier](https://prettier.io/) and [Prettier PHP Plugin](https://github.com/prettier/plugin-php).

## Starter Template

https://livecodes.io/?template=php

## Links

- [PHP](https://php.net/)
- [PHP documentation](https://www.php.net/manual/en/)
- [Uniter](https://phptojs.com/)
- [PHP using `php-wasm`](./php-wasm.md) in LiveCodes

0 comments on commit 7a23ce8

Please sign in to comment.