PHP templates

Web.dev.app supports a subset of the PHP template language. Files with a .php extension will be interpreted as templates and rendered as HTML pages. The home page or any other page of an app may be a PHP file. Files loaded from Internet addresses will be treated as plain text instead of templates.

Use <?php to begin scripting, <?= to echo a value, and ?> to close. Files can be inserted using 'include', 'include_once', 'require', or 'require_once'. Use the debugger keyword to set a breakpoint, the same as Javascript.

Built-in Javascript functions and objects are available to PHP scripts using the dev.code.JS namespace. The extended dev API is also available.

Built-in PHP functions and objects are available to JavaScript using the dev.code.PHP namespace. For example, you can use dev.code.PHP.SQLite3 to open a SQLite3 database from within JavaScript.

PHP may be included in a HTML page using <script type='text/php'>. It may be written inside the tag or loaded from a source file. It can be rendered into HTML and returned as a string using... script_element.render (optional_GET_object)

PHP files can also be rendered into HTML pages during dev.http.server requests.

Implementation

Only a limited set of PHP functions and objects will be supported, with a focus on PHP's well known database APIs.

Supported functions and objects are auto-listed here. Please refer to PHP references for detailed information. Web.dev.app's implementation of some features may be inferior to the documented standard.

To use a database like SQLite3, the database connector (sqlite3.dll or sqlite3.so) must be in the app folder or on the operating system. See shared libraries.