PHP code example of roastrofficial-ctrl / xphp

1. Go to this page and download the library: Download roastrofficial-ctrl/xphp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

roastrofficial-ctrl / xphp example snippets


// src/Services/UserService.xphp — just start writing

class UserService
{
    public function getUser(int $id): User
    {
        return User::find($id); // strict types enforced, no boilerplate needed
    }
}

// Option A — raw (no opening tag needed)
class MyClass { }

// Option B — keep the tag, skip the declare

class MyClass { }
bash
$ vendor/bin/xphp-lint src/BadFile.xphp
✗ src/BadFile.xphp
  [php] Parse error: syntax error, unexpected end of file
  [pint] 5 style issues found