rfc:phpp
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:phpp [2012/04/12 22:55] – created kriscraig | rfc:phpp [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Request for Comments: New File Type for Pure-Code PHP Scripts ====== | ====== Request for Comments: New File Type for Pure-Code PHP Scripts ====== | ||
- | * RFC Version: 1.00 | + | * RFC Version: 1.20 |
* Target PHP Version: 6.0 | * Target PHP Version: 6.0 | ||
* Date: 2012-04-12 | * Date: 2012-04-12 | ||
* Author: Kris Craig < | * Author: Kris Craig < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 10: | Line 10: | ||
===== Abstract ===== | ===== Abstract ===== | ||
- | This RFC proposes the creation of a new .phpp file type. | + | This RFC proposes the creation of a new .phpp file type and a new .phpf file type. These file types will both be parsed by the webserver as 100% PHP code; that is, all code will be executed //without// <?php and ?> tags. No raw HTML output would be allowed in these scripts using ?>, though echo/print and other output statements will continue to work in those scripts without any restriction. |
===== Background ===== | ===== Background ===== | ||
Line 23: | Line 23: | ||
As the web has evolved, so too have the various methods for developing in it. PHP now largely takes the form of classes and code-only libraries that are hooked from the UI layer of the modern website. | As the web has evolved, so too have the various methods for developing in it. PHP now largely takes the form of classes and code-only libraries that are hooked from the UI layer of the modern website. | ||
+ | |||
+ | However, many frameworks utilize more " | ||
==== The Tags ==== | ==== The Tags ==== | ||
Line 55: | Line 57: | ||
* Any .phpp scripts included by a .phpp file must also adhere to these rules and contain only pure HTML code. | * Any .phpp scripts included by a .phpp file must also adhere to these rules and contain only pure HTML code. | ||
* A regular .php script cannot be included from a .phpp script. | * A regular .php script cannot be included from a .phpp script. | ||
+ | |||
+ | However, there are frameworks and libraries that don't follow a segregated framework but would nonetheless benefit from being able to use PHP-only files. | ||
+ | |||
+ | A .phpf file would behave exactly like a .phpp file, //except// that regular .php scripts //can// be included and are allowed to contain raw ?> content. | ||
==== Inclusion of Mixed Code ==== | ==== Inclusion of Mixed Code ==== | ||
- | It has been suggested that regular .php files that contain raw HTML should be able to be included by a .phpp file because someone might want to include a regular .php library | + | The .phpp file type is generally intended for use with applications that have been designed |
- | Besides, such an allowance is completely unnecessary anyway, since using non-horrible architecture can achieve | + | The following flow chart shows an example of both the right way and the wrong way to use a .phpp stack: |
{{: | {{: | ||
+ | |||
+ | ==== Naming Conventions ==== | ||
+ | |||
+ | Obviously, PHP does not rely on file extensions themselves to determine how to parse a script. | ||
+ | |||
+ | ==== Script Inclusion ==== | ||
+ | |||
+ | If you're including a .phpf or .phpp script from within a PHP script, we'll need a way to tell PHP what type of file we're including. | ||
+ | |||
+ | require[(] $script_filename, | ||
+ | |||
+ | Possible values for $script_type: | ||
+ | |||
+ | PHP_SCRIPT_TYPE_NORMAL (0x01) | ||
+ | * If the included file contains PHP code, parse it. | ||
+ | |||
+ | PHP_SCRIPT_TYPE_TAGLESS (0x02) | ||
+ | * Code is assumed to be PHP throughout the script. | ||
+ | |||
+ | PHP_SCRIPT_TYPE_STACK (0x04) | ||
+ | * The $script_type is applied to all child scripts of the one being included. | ||
+ | * Question : Would anyone see value in adding an override constant that, while not recommended, | ||
+ | |||
+ | PHP_SCRIPT_TYPE_CODE_FILE (PHP_SCRIPT_TYPE_NORMAL & PHP_SCRIPT_TYPE_TAGLESS) | ||
+ | * The entire script is assumed to be PHP code and is parsed accordingly. | ||
+ | |||
+ | PHP_SCRIPT_TYPE_CODE_STACK (PHP_SCRIPT_TYPE_NORMAL & PHP_SCRIPT_TYPE_TAGLESS & PHP_SCRIPT_TYPE_STACK) | ||
+ | * The entire script and all its child scripts (i.e. its " | ||
+ | |||
+ | ==== Using " | ||
+ | |||
+ | It has been suggested that, instead of " | ||
+ | |||
+ | ==== Webserver Execution ==== | ||
+ | |||
+ | Ideally, we want .phpf and .phpp files to be able to be directly executed from the browser in addition to include/ | ||
+ | |||
+ | However, script inclusion is the more important priority. | ||
===== Final Thoughts ===== | ===== Final Thoughts ===== | ||
Line 75: | Line 119: | ||
===== Changelog ===== | ===== Changelog ===== | ||
+ | |||
+ | Version 1.20 : Language clarifications. | ||
+ | |||
+ | Version 1.10 : Status => Under Discussion. | ||
Version 1.00 : Initial proposal. | Version 1.00 : Initial proposal. | ||
rfc/phpp.1334271307.txt.gz · Last modified: 2017/09/22 13:28 (external edit)