Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmorris committed Aug 22, 2020
0 parents commit 18aea1c
Show file tree
Hide file tree
Showing 12 changed files with 11,545 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
*.lo
*.la
.libs
acinclude.m4
aclocal.m4
autom4te.cache
build
config.guess
config.h
config.h.in
config.log
config.nice
config.status
config.sub
configure
configure.ac
configure.in
include
install-sh
libtool
ltmain.sh
Makefile
Makefile.fragments
Makefile.global
Makefile.objects
missing
mkinstalldirs
modules
run-tests.php
tests/*/*.diff
tests/*/*.out
tests/*/*.php
tests/*/*.exp
tests/*/*.log
tests/*/*.sh
85 changes: 85 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# What is VRZNO?

(/vərəˈzɑːnoʊ/ vər-ə-ZAH-noh)

VRZNO is a bridge between Javascript & PHP in an extremely nontraditional sense.

* VRZNO lets you call javascript code from PHP.

* VRZNO is a statically compiled PHP module.

* VRZNO runs in-browser.

## How is this possible?

VRZNO is the first PHP extension built for PIB/php-wasm. Once its compiled with PHP to WASM, it can be served to any browser and executed client side.

The PIB/php-wasm packages allow you to call PHP from javascript, the only way to communicate from PHP back to JS was to print output.

This changes all that.

VRZNO allows you to control the page directly from PHP.

## Usage

At the moment, the only exposed functions are vrzno_run($funcName, $args) & vrzno_eval($js).

`vrzno_run` will execute a global function. It takes a function name as the first param, and an array of arguments as its second:

```php
<?php vrzno_run('alert', ['Hello, world!']);
```

`vrzno_eval` will run any javascript code provided in its first param in the context of the page, and return its response as a string to PHP:

```php
<?php vrzno_eval('alert(`Hello, world!`)');
```

There are plans in the works for `vrzno_set($varname, $value)`, `vrzno_get($varname)`, and `vrzno_select($namespace)`.

## Compiling (incomplete)

```bash
# Clone the PHP Repo
git clone https://github.com/php/php-src.git;

# Enter the extension directory
cd php-src/ext;


# Clone the VRZNO repo into the PHP source tree
git clone https://github.com/seanmorris/vrzno.git;

cd vrzno;

rm configure # Remove the configure script if any exists
./buildconf --force # Rebuild the configuration script

# Run the new configuration script via emscripten.
emconfigure \
./configure \
--disable-all \
--disable-cgi \
--disable-cli \
--disable-rpath \
--disable-phpdbg \
--with-valgrind=no \
--without-pear \
--without-pcre-jit \
--with-layout=GNU \
--enable-embed=static \
--enable-bcmath \
--enable-json \
--enable-ctype \
--enable-mbstring \
--disable-mbregex \
--enable-tokenizer \
--enable-vrzno

# Run the make scripts with emscripten.
emmake make -j8

#

```
Loading

0 comments on commit 18aea1c

Please sign in to comment.