Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
PHP preprocessor that makes your code look beautiful
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
js allows alternative syntax with colons for control structures
src
test
.gitignore
composer.json
makefile
readme.md

readme.md

LadyPHP makes your code look beautiful

Introduction

Do you also hate all these dollars, arrows and $this everywhere in you PHP files? Well, PHP just isn't the sexiest one when compared to other languages. But still you're not going to switch language just because the syntax, right? Now you can switch syntax without leaving the language, meet LadyPHP!

LadyPHP is a preprocessor for PHP, that allows you to write code with cleaner syntax. It can do conversion in both ways, so you can start writing your current projects with lady syntax right away and save them back to PHP, your collaborators won't notice.

This software is still under heavy development, syntax and API can be changed.

Demo

You can try JavaScript version of LadyPHP right in your browser.

Download

Syntax reference

LadyPHP PHP
x $x
obj.x $obj->x
Cls.x Cls::$x
@x $this->x
@@x self::$x
public f() public function f()
[k: 'v'] ['k' => 'v']
x ~ y x . y
<? <?php

Semicolons at the end of lines are optional.

To write operators @ and ~, you have to escape them with \.

Usage from command line

ladyphp file.lady  # creates file.php
ladyphp file.php   # creates file.lady
ladyphp -r dir/    # converts all php files in directory to ladyphp
ladyphp -w dir/    # watches directory and converts updated lady files

Credits

LadyPHP is created by Honza Novák and it's licensed under a Creative Commons BY-SA.

Something went wrong with that request. Please try again.