/now-builders

Unofficial Now Builders for PHP and the others by @f3l1x

Primary LanguageJavaScriptMIT LicenseMIT

JuicyFx Now Builders

The main goal is to provide experimental Now Builders on steroids.
Mainly for PHP with focus on latest versions and more proprietal configurations.

πŸ•Ή f3l1x.io | πŸ’» f3l1x | 🐦 @xf3l1x

🐘 PHP

Builders

  • Server βœ… (PHP Development Server)
  • CGI βœ… (Common Gateway Interface)
  • CLI βœ… (Command-line interface)
  • FPM βœ…πŸ₯ (PHP-FPM)
  • Bref βœ… (Bref.sh)
  • FPM βœ…πŸ₯ (Caddy server + FPM)

PHP versions

  • PHP 7.2 βœ…
  • PHP 7.3 βœ…
  • PHP 7.4 βœ…
  • PHP 8.0 πŸ”₯

PHP 5.5, 5.6, 7.0 or 7.1 are not supported.

Extensions

Preinstalled: apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dom, ds, exif, fileinfo, filter, ftp, gettext, hash, iconv, json, libxml, mbstring, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, phalcon (< 7.4), Phar, readline, Reflection, session, SimpleXML, soap, sockets, sodium, SPL, sqlite3, ssh2, standard, swoole, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zlib

List of all installable extensions is on this page https://blog.remirepo.net/pages/PECL-extensions-RPM-status.

πŸ“¦ Packages

PHP builders

Package Stable Canary Description
@juicyfx/php 0.0.7 @canary Final PHP builder.
@juicyfx/php-bridge 0.0.2 @canary PHP builder bridge with DevServer, FPM, CGI and CLI.
@juicyfx/php-bref 0.0.1 @canary Final PHP builder with Bref.sh. (Only with PHP 7.2)
@juicyfx/php-caddy 0.0.1 @canary Final PHP builder with Caddy server with FASTCGI.

PHP libraries

Package Stable Canary Description
@juicyfx/php-lib-72 0.0.5 @canary PHP 7.2 binaries and shared libraries.
@juicyfx/php-lib-73 0.0.5 @canary PHP 7.3 binaries and shared libraries.
@juicyfx/php-lib-74 0.0.5 @canary PHP 7.4 binaries and shared libraries.

Speed

Builder Cold Warm
@juicyfx/php (mode:server) ~250ms ~5ms
@juicyfx/php (mode:cgi) ~220ms ~40ms
@juicyfx/php (mode:cli) ~220ms ~35ms
@juicyfx/php (mode:fpm) ~170ms ~160ms
@juicyfx/php-caddy ~450ms ~5ms
@juicyfx/php-bref ~255ms ~2ms

βš™οΈ Usage

There is prepared builder for your PHP lambdas @juicyfx/php.

Minimal

{
  "version": 2,
  "builds": [
    {
      "src": "index.php",
      "use": "@juicyfx/php",
    }
  ]
}

🚧Everything is HOT right now, so you should rather test the @juicyfx/php@canary version.

Config

{
  "version": 2,
  "builds": [
    {
      "src": "index.php",
      "use": "@juicyfx/php",
      "config": {
        "v": "7.3"
        "mode": "server",
      }
    }
  ]
}
  • v [optional]
    • Set the PHP version.
    • Type: string
    • Default: 7.3
    • Values: 7.2 | 7.3 | 7.4
  • mode [optional]
    • Set the PHP launcher (bridge).
    • Type: string
    • Default: server
    • Values: server | cgi | cli | fpm
  • composer [optional]
    • Call composer install.
    • Type: boolean
    • Default: false
    • Values: true/false
    • Warning: Only supported on PHP 7.2, 7.3

πŸ€—Features

  • multiple PHP versions
  • multiple running modes (server, cgi, cli, fpm)
  • install dependencies via Composer

πŸš€ Roadmap

  • Support now dev
  • Resolve known issues (HELP WANTED)

πŸ€” Known Issues

  • PHP-FPM - Uncaught Exception - socket hang up

    • This is known issue and I would apreaciate any help.
    START RequestId: 1811b891-d871-4260-9ea3-1277c24a2d59 Version: $LATEST
    2019-06-22T16:50:54.848Z	1811b891-d871-4260-9ea3-1277c24a2d59	INFO	Starting PHP
    2019-06-22T16:50:55.076Z	1811b891-d871-4260-9ea3-1277c24a2d59	ERROR	Uncaught Exception	{"errorType":"Error","errorMessage":"socket hang up","code":"ECONNRESET","stack":["Error: socket hang up","    at createHangUpError (_http_client.js:323:15)","    at Socket.socketOnEnd (_http_client.js:426:23)","    at Socket.emit (events.js:194:15)","    at endReadableNT (_stream_readable.js:1125:12)","    at process._tickCallback (internal/process/next_tick.js:63:19)"]}
    END RequestId: 1811b891-d871-4260-9ea3-1277c24a2d59
    REPORT RequestId: 1811b891-d871-4260-9ea3-1277c24a2d59
    Duration: 270.75 ms  Billed Duration: 300 ms   Memory Size: 3008 MB  Max Memory Used: 115 MB
    RequestId: 1811b891-d871-4260-9ea3-1277c24a2d59 Process exited before completing request
    

πŸ‘€ Examples

Server

CGI

CLI

FPM

Extensions

Versions

Nette

Bref

πŸ“š Resources

πŸ“ License

Copyright Β© 2019 f3l1x. This project is MIT licensed.