Interactive Serverless Playground
ย
30.05.2020

@xf3l1x
f3l1x.io
Why
Why?
- Idea
- Challenge
- Experience
- Utils & tools
- Fun
accepted!
(latte examples)
Research
jsfiddle.net

codesandbox.io

Github Codespaces


regex101.com
3v4l.org
php.wtf

phpstan.org

getrector.org

tinkerwell.app

PHP sandboxes
-
3v4l.org (php.wtf)
-
phpstan.org
-
getrector.org
-
tinkerwell.app
-
w3schools.com
-
phpfiddle.org
-
onlinephpfunctions.com
-
writephponline.com
-
phptester.net
-
paiza.io

ARE YOU F*'N KIDDING ME?
Features
Features
- HTTP-based
- microservices
- first-class-nette
- user-friendly
- easy-to-maintain
- persistent
- zero-costs
How


VPS
-
Charged 24/7ย
-
Maintenance
-
Security updates
-
Scaling up/down








WebAssembly
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-tokenizeremcc -O3 \
--llvm-lto 2 \
-s ENVIRONMENT=web \
-s EXPORTED_FUNCTIONS='["_pib_eval", "_php_embed_init", "_zend_eval_string", "_php_embed_shutdown"]' \
-s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall"]' \
-s MODULARIZE=1 \
-s EXPORT_NAME="'PHP'" \
-s TOTAL_MEMORY=134217728 \
-s ASSERTIONS=0 \
-s INVOKE_RUN=0 \
-s ERROR_ON_UNDEFINED_SYMBOLS=0 \
--preload-file Zend/bench.php \
libs/libphp7.a pib_eval.o -o out/php.jsServerless


{
"functions": {
}
}Vercel + PHP
now.json
{
"functions": {
"api/index.php": {
"runtime": "now-php@0.0.9"
}
}
}Vercel + PHP
now.json




















๐จ๐ปโ๐ป


Dreamed Architecture
WEB
Text
STORAGE


NETTE
STRINGS
a
TIME
XYZ
ANALYTICS
SERVICES
Textarea Architecture
UI
DB
(mysql)
save
UI
load
<TEXTAREA>
<CODE>

Name!
lessik
serverless
lesรญk
lessik
โโโ services
โ โโโ nette (PHP)
โ โ โโโ api/*.php
โ โ โโโ src
โ โ โโโ now.json
โ โ โโโ composer.json
โ โโโ strings (PHP)
โ โ โโโ api/*.php
โ โ โโโ src
โ โ โโโ now.json
โ โ โโโ composer.json
โ โโโ time (PHP)
โ โ โโโ api/*.php
โ โ โโโ src
โ โ โโโ now.json
โ โ โโโ composer.json
โโโ sites (JS, TS, Vue)
โ โโโ lessik
โ โโโ src
โ โโโ now.json
โ โโโ tsconfig.json
โ โโโ tailwind.config.js
โ โโโ package.json
โโโ Makefilemake sites-lessik-devmake services-nette-devmake services-strings-dev0.0.0.0:1234
Parcel JS
PHP built-in server
0.0.0.0:8000
PHP built-in server
0.0.0.0:8001
Development
terminals
Development
app.ts
export const NAME = "LESSIK";
export const VERSION = "v0.1";
// Services
export const SERVICE_NETTE =
process.env.SERVICE_NETTE || 'http://0.0.0.0:8000';
export const SERVICE_STRINGS =
process.env.SERVICE_STRINGS || 'http://0.0.0.0:8001';
Development
request & response
const output = await fetch(SERVICE_NETTE, {body});<?php declare(strict_types = 1);
$latte = Request::param('code');
$output = ['result' => Runner::doLatte($latte)];
Response::header('content-type', 'application/json');
Response::code(200);
echo Json::encode($output);
exit();Web UI (0.0.0.0:1234)
Nette Service (0.0.0.0:8000)

DEPLOYMENT
VERCEL

strings-v1.felix.tld
nette-v1.felix.tld







3rd party
-
monitoring
-
telemetry logs
-
error handling
-
analytics
-
custom







Dark Lang


web
Hold Your ๐๐๐
Hold Your ๐๐๐
Subscribe For Invitation

Conclusion
-
think big
-
take challenges
-
explore & conquer
-
share experience
-
have fun
๐คฉ ๐ข
Time to selfie ๐ท

Github Sponsors
Thank you

Support My OSS

@xf3l1x
f3l1x.io
?
What? Why? How? No? Oh.
Thank you!
Go LESSIK!


@xf3l1x
f3l1x.io
