For full documentation, visit php-plus.com.
Plus is a runtime compiler that adds features to PHP - It's also a package that you can require using composer, and is mainly used to add features and syntactic sugar to existing PHP code. Of course, those features arrive in PHP using runtime source code transformations. It was created by, and currently maintained by Nuno Maduro, and Christopher Pitt. Art work is provided by Caneco.
Enjoy a simple and powerful syntax that enables developers to build very complex applications far more quickly than before. Short closures, types, enumerations are just a few examples of what you get using Plus.
Note: Plus is still work in progress and it's not out yet.
- First, install:
composer require pre/plus
- Then, in your editor, add the following declare:
<?php
declare(plus=1);
class User {
// A readonly property cannot be assigned after the constructor exits
public readonly string $name;
// No need for the `t_function` keyword
public __construct(string $name) {
$this->name = $name;
}
// One expression functions with return statement
public getUppercasedName(): string => strtoupper($this->name)
}
Plus is open-sourced software licensed under the MIT license.