Manual
phpx manual
With phpx, you get phpscript with real PHP compatibility.
- Classes that extend, traits that compose, abstract classes
- Property and method visibility, readonly, promoted constructors
- Late static binding, global, stdClass and __toString
- Null coalescing, nullsafe calls, arrow functions, spread
- Composer autoload, Reflection with attributes, the SPL set
- phpunit run from its own source tree
Browse the reference phpx on GitHub
The language
phpx is a fork of phpscript that reverses the decisions standing between the
runtime and code written for PHP. A class extends another and inherits its
fields, methods, statics and constants; parent::__construct()
chains, instanceof walks the chain, and a class may extend
Exception, Error and the SPL throwables. A trait
composes into a class, and insteadof and as settle
what two of them disagree on. abstract refuses a
new and refuses a concrete class that leaves a method to a
child.
A property or a method declares private or
protected and the runtime enforces it with php's own message.
readonly admits one write. A constructor promotes its parameters.
static::, new static and
get_called_class() name the calling class.
global binds a name to the global frame, stdClass
exists and json_decode answers one.
The syntax follows: ?? and ??=,
?->, <=>, fn() =>,
f(...$args), $obj::class, match,
enum, destructuring, heredoc, named arguments and
throw as an expression.
Packages
A composer vendor/ loads through
vendor/autoload.php, which needs the autoloader's
Closure::bind and the class map it builds. phpunit runs from its own
source tree: five test files, data providers and #[TestWith]
included, printing what php prints. Reflection reads attributes, the SPL
structures and iterators answer, and a class may declare
JsonSerializable.
Where it stands
phpx is experimental and the surface moves. It runs software phpscript refuses, and a program that runs today may meet a gap tomorrow: a throwable records no file or line, a trait declared in one included file is invisible to a class in another, and the bytecode engine hands any program with inheritance, traits or a non-public property to the interpreter.
The same generator writes this tree and the phpscript manual, each from what its own binary registers. Every page under here is the fork's inventory.