PHPackages                             xp-lang/compiler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. xp-lang/compiler

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

xp-lang/compiler
================

XP Compiler

v7.1.1(9y ago)8121[4 issues](https://github.com/xp-lang/compiler/issues)[3 PRs](https://github.com/xp-lang/compiler/pulls)BSD-3-ClausePHPPHP &gt;=5.5.0

Since Mar 1Pushed 9y ago2 watchersCompare

[ Source](https://github.com/xp-lang/compiler)[ Packagist](https://packagist.org/packages/xp-lang/compiler)[ Docs](http://xp-framework.net/)[ RSS](/packages/xp-lang-compiler/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (11)Versions (17)Used By (0)

XP Language
===========

[](#xp-language)

[![Build Status](https://camo.githubusercontent.com/240817aee8a661c3657a683b0c0cc12b54e1d461a0760d7a601c705a2a9d98bf/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f78702d6c616e672f636f6d70696c65722e706e67)](https://travis-ci.org/xp-lang/compiler)[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)[![Required PHP 5.5+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-5_5plus.png)](http://php.net/)[![Supports PHP 7.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_0plus.png)](http://php.net/)[![Supports HHVM 3.5+](https://raw.githubusercontent.com/xp-framework/web/master/static/hhvm-3_5plus.png)](http://hhvm.com/)[![Latest Stable Version](https://camo.githubusercontent.com/6459e296b13451e3c5e560a1f3257e83a578477469793500f1186e0eec93510a/68747470733a2f2f706f7365722e707567782e6f72672f78702d6c616e672f636f6d70696c65722f76657273696f6e2e706e67)](https://packagist.org/packages/xp-lang/compiler)

XP language is a feature-rich, typed and compiled programming language, based on the popular PHP language and designed to syntactically support features of the XP Framework. The source you write and compile with it can make use of the XP Framework's foundation classes. As the language itself is written in the XP Framework, no binary or proprietary extensions are needed!

Getting started
---------------

[](#getting-started)

Like in the XP framework, the entry point is always a class. In their most simple form, these classes have a static main() method. To try it out, create a file called `HelloWorld.xp` with the following contents:

```
public class HelloWorld {
  public static void main(string[] $args) {
    util.cmd.Console::writeLine('Hello World!');
  }
}
```

Then compile and run it!

```
$ xp HelloWorld
Hello World!
```

### Differences

[](#differences)

The things you will have noticed are:

- Classes may also have modifiers.
- The `extends Object` is optional and added by the compiler if omitted.
- The keyword `function` is gone and replaced by the return type. Because the main() method does not return anything, we use void.
- An array type is written as component\[\]
- Variables still have dollar signs. This makes it easy to spot them, that's why we've decided to keep this!
- Fully qualified classnames are written with dots.
- The object operator is also a dot (at the same time, the string concatenation operator is now the tilde, `~`).

### Features

[](#features)

The XP Language features - among others - support for the following:

- Namespaces (which are called packages)
- Imports, static imports and "on-demand" imports (`import util.*;`)
- Varargs syntax
- Distinguishable types for arrays and maps
- Class literal `::class`, and `finally` - also for PHP &lt; 5.5!
- Properties with `get` and `set`, and Indexers
- Syntactic support for the following XP Framework features: Typesafe enumerations, Annotations, Generics, the `with` statement and a throws clause

### Further reading

[](#further-reading)

To get an overview of XP Language's features, these are good reads:

- [The XP Language Wiki](https://github.com/xp-lang/compiler/wiki)
- [RFC #0052: Make XP its own (compiled) language](https://github.com/xp-framework/rfc/issues/52)

Developing
----------

[](#developing)

In order to change XP Language and/or the Compiler **itself**, you need to clone this repository, e.g. using Git Read-Only:

```
$ cd [path]
$ git clone git://github.com/xp-lang/compiler.git
```

### Directory structure

[](#directory-structure)

```
[path]/compiler
 |- ChangeLog.md      # Version log
 |- README.md         # This file
 |- module.pth        # Module classpath
 `- src               # Sourcecode, by Maven conventions
    |- main
    |  `- php
    `- test
       |- php
       `- config      # Unittest configuration

```

### Using it

[](#using-it)

Add that path to your `use` setting before the global module path inside your `xp.ini`, e.g.:

```
use=~/devel/xp-framework/core:~/devel/xp-lang/compiler
                              ^^^^^^^^^^^^^^^^^^^^^^^^
```

*On Windows systems, use `;` as separator*

**Enjoy!**

Contributing
------------

[](#contributing)

To contribute, use the GitHub way - fork, hack, and submit a pull request!

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 96.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~44 days

Recently: every ~63 days

Total

14

Last Release

3561d ago

Major Versions

v2.1.0 → v3.0.02015-08-16

v3.0.0 → v4.0.02015-11-08

v4.1.0 → v5.0.02015-12-13

v5.0.1 → v6.0.02016-01-23

v6.0.1 → v7.0.02016-02-22

PHP version history (2 changes)v2.0.0PHP &gt;=5.4.0

v5.0.0PHP &gt;=5.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/07d18d882c8b4aaf3466432f64018214f2771eda333202175431ee7233795376?d=identicon)[thekid](/maintainers/thekid)

---

Top Contributors

[![thekid](https://avatars.githubusercontent.com/u/696742?v=4)](https://github.com/thekid "thekid (12126 commits)")[![kiesel](https://avatars.githubusercontent.com/u/127769?v=4)](https://github.com/kiesel "kiesel (457 commits)")

---

Tags

xp

### Embed Badge

![Health badge](/badges/xp-lang-compiler/health.svg)

```
[![Health](https://phpackages.com/badges/xp-lang-compiler/health.svg)](https://phpackages.com/packages/xp-lang-compiler)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
