Search by

atatusoft-ltd / ppphp-src

++PHP is a superset of PHP that compiles to clean PHP output.

Maintainers

Package info

github.com/atatusoft-ltd/ppphp-src

Homepage

pkg:composer/atatusoft-ltd/ppphp-src

Transparency log

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2026.3.1-rc-1 2026-09-02 23:43 UTC

This package is auto-updated.

Last update: 2026-09-06 19:50:52 UTC


README

++PHP Logo

CI status PHP ^8.4 Composer Package 2026.3.1-rc-2 License

++PHP

++PHP (pronounced “plus plus PHP”) is a source language and compiler for PHP projects. It adds compile-time type safety and expressive language features, then emits ordinary PHP for the official PHP runtime.

Why ++PHP

++PHP is designed for gradual adoption. Existing .php files can stay in place while selected files move to .ppphp. The compiler checks both kinds of source together and builds one ordinary-PHP application for deployment.

Use ++PHP when you want stronger contracts without introducing a custom runtime:

  • catch type, nullability, member, collection, and checked-error mistakes before deployment;
  • express typed local variables, erased generics, and typed collections directly in source;
  • keep Composer packages and existing PHP code in the same project; and
  • deploy generated PHP using familiar PHP and Composer infrastructure.

Release Status

++PHP 2026.3.1-rc-2 is a release candidate. It is suitable for evaluation and early project use, but behavior may still change before the first Stable release.

This candidate is prepared in the repository but is not yet publicly available from GitHub Releases or Packagist. Until it is published, use a repository checkout for evaluation.

Language Highlights

  • Explicitly typed mutable and readonly local bindings
  • Strict project-wide typing
  • Union, intersection, and DNF types
  • Erased generics
  • Typed list and map arrays
  • Checked errors
  • Value-producing when expressions
  • Mixed .php and .ppphp projects
  • Deterministic PHP output and source-mapped diagnostics
  • Composer-aware builds
  • Incremental, hash-verified compiler caching

Example Source And Generated PHP

++PHP source can declare local types that PHP itself does not accept:

<?php

function greeting(string $input): string
{
    string $name = trim($input);
    readonly string $prefix = 'Hello';

    return $prefix . ', ' . $name;
}

The compiler erases the extension syntax and preserves its type contract as PHPDoc:

<?php

declare(strict_types=1);

function greeting(string $input): string
{
    /** @var string $name */ $name = trim($input);
    /** @var string $prefix */ $prefix = 'Hello';

    return $prefix . ', ' . $name;
}

Generics, typed arrays, checked throws clauses, and when expressions are also compile-time features. Generated code contains ordinary PHP syntax and requires no ++PHP runtime library.

Requirements

  • PHP ^8.4
  • Composer 2
  • At least 512 MiB of memory available to compiler processes

Generated code targets PHP 8.4.

Installation

When this candidate is published, install its exact prerelease version:

composer require --dev atatusoft-ltd/ppphp-src:2026.3.1-rc-2

The Stable channel will remain Composer's default; release candidates require an explicit version. From a repository checkout, install locked dependencies and run the compiler directly:

composer install
php bin/ppphp --help

The Composer package is atatusoft-ltd/ppphp-src. Its canonical PHP namespace is Atatusoft\Ppphp, while the supported user entry point is the ppphp command.

Quick Start

From a project where ++PHP is installed:

vendor/bin/ppphp init
vendor/bin/ppphp composer:configure --dry-run
vendor/bin/ppphp composer:configure
composer update --lock --no-interaction --no-scripts
composer dump-autoload --optimize
vendor/bin/ppphp check
vendor/bin/ppphp build

ppphp init creates ppphp.json and the configured build/ppphp, .ppphp-cache, and stub directories. composer:configure projects root application autoload mappings to generated output while preserving their source forms for analysis.

Use ppphp check [path] to validate the complete project, a directory, or one project-owned source file. Use ppphp build [path] to compile selected .ppphp files and copy selected .php files into the configured output.

See Getting Started for a complete executable example.

Mixed PHP/++PHP Projects

Ordinary .php source retains normal PHP behavior and participates in symbol and type analysis. It is copied byte-for-byte into selected build output. .ppphp source receives the ++PHP language checks and compiles to .php in the same output tree.

Focused commands use valid unselected declarations as context without reporting unrelated errors from unselected bodies. Complete builds are intended for deployment. See Mixed Projects and PHP Interoperability.

Building And Deployment

A complete ppphp build checks the project before replacing the compiler-owned output tree. New PHP files must pass isolated PHP linting, and a failed build preserves the previous successful output. Manifests and source maps record each generated artifact.

Deploy the configured output tree with the root Composer metadata and installed dependencies. Do not execute .ppphp files directly or place hand-maintained files inside build/ppphp. See Build Output and Composer Runtime Integration.

Editor Support

The repository provides bounded definition and semantic-token protocols for editor integrations. They are internal integration surfaces rather than a standalone language server. See the Editor Protocol.

Current Limitations

  • Generated source targets PHP 8.4.
  • Native ppphp check and ppphp build include supplemental PHPStan analysis.
  • Deep analysis of ordinary PHP implementation bodies is supplied by PHPStan.
  • Generator-specific compiler-owned flow analysis remains limited.
  • Browser compiler analysis is an internal integration protocol, not a supported browser build product.
  • No formatter is included.
  • No standalone language server is included in this repository.
  • Immutable Records, postfix list syntax, Native Type Members, and attribute factory expressions are planned work and are not part of this release.

Documentation

Visit ppphplang.org for the public ++PHP website.

Security

Report vulnerabilities privately using the process in SECURITY.md.

Contributing

Repository contributors should read AGENTS.md and the maintainer release guide before changing compiler or release behavior.

License

Licensed under the Apache License 2.0.