Typed locals
Declare every local with one explicit, fixed type and initializer. Add readonly when its storage must not change.
PHP, with more certainty
++PHP adds generics, typed locals and arrays, checked errors, and value-producing
when expressions, then emits ordinary PHP for PHP 8.4+.
The complete ++PHP language
Express relationships that PHP tools can follow across your project, then deploy readable PHP through the workflow you already use.
Declare every local with one explicit, fixed type and initializer. Add readonly when its storage must not change.
Write reusable classes and callables with checked type parameters that compile to PHPDoc and ordinary PHP.
Use array<T> for lists and array<K, V> for maps while keeping normal PHP array behavior at runtime.
Produce one typed value from complete conditional branches with room for meaningful work in every branch.
Declare recoverable failures with throws and require every caller to catch or propagate them.
Adopt ++PHP file by file. Check .php and .ppphp together, then build one complete PHP application.
Transparent compilation
Generic relationships become conventional PHPDoc; typed arrays and when become ordinary PHP syntax.
The result remains inspectable by your team and familiar to PHP tools.
See how the language works
<?php
class Box<T>
{
function __construct(
private T $value
) {}
function get(): T
{
return $this->value;
}
}
Money $total = when ($orders !== []) {
Money $sum = Money::zero();
foreach ($orders as $o) {
$sum = $sum->plus($o->total());
}
return $sum;
} else {
return Money::zero();
};
<?php
declare(strict_types=1);
/** @template T */
class Box
{
/** @param T $value */
function __construct(
private $value
) {}
/** @return T */
function get()
{
return $this->value;
}
}
if ($orders !== []) {
$__t1 = Money::zero();
foreach ($orders as $o) {
$__t1 = $__t1->plus($o->total());
}
$__w1 = $__t1;
} else {
$__w1 = Money::zero();
}
$total = $__w1;
One compiler, three commands
Start with the boundary you choose. ++PHP can analyze the whole project, a directory, or one focused file without mutating source.
init
check
build
Questions, answered
The compiler produces ordinary PHP for PHP 8.4+ that runs with your Composer packages, extensions, web server, workers, and deployment tools.
Yes. .php and .ppphp files can live in the same source roots. Plain PHP participates in analysis and is copied into the build unchanged.
They are erased. The compiler checks each relationship, then emits deterministic PHPDoc that PHPStan, IDEs, and ordinary PHP consumers understand.
Yes. It follows Composer autoloading, installed packages, native PHP types, and PHPDoc while checking your project.
The compiler is open source under the Apache License 2.0.
Bring certainty to an existing codebase
Begin with one .ppphp file, keep every dependency, and deploy the PHP you already know.