From 7a23ce8a16072b845d7621bbadbe67603e00687f Mon Sep 17 00:00:00 2001 From: Hatem Hosny Date: Sat, 14 Oct 2023 23:30:08 +0300 Subject: [PATCH] docs(compilers): add docs for php --- docs/docs/languages/php-wasm.md | 3 +- docs/docs/languages/php.md | 59 ++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/docs/docs/languages/php-wasm.md b/docs/docs/languages/php-wasm.md index c70b1593a..823888c93 100644 --- a/docs/docs/languages/php-wasm.md +++ b/docs/docs/languages/php-wasm.md @@ -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)). @@ -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 diff --git a/docs/docs/languages/php.md b/docs/docs/languages/php.md index 90f4c7088..3ab7461fe 100644 --- a/docs/docs/languages/php.md +++ b/docs/docs/languages/php.md @@ -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: + + + +## 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