Skip to content

ashleycoles/gbphp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GBPHP

PHP the way god intended.

A simple 'compiler' that converts GBPHP (Great British PHP) into vanilla PHP.

Inspired by Dave Childs article If PHP Were British

Installation

  1. Put the kettle on
  2. Clone the repo
  3. Put teabag in mug
  4. Run composer install
  5. Add hot water to mug
  6. Update gbphp-config.json so the input directory (the location of the .gbphp files) and output directory (where the compiled php files are saved) are correct for your project
  7. Remove teabag, add sugar and milk to taste
  8. run php compile-gbphp.php to compile
  9. Enjoy

Language Usage Examples

Variables

£variable = 'Hello World';

If statements

perchance (£name == 'Ash') {
    announce 'Hi' . £name;
} otherwise {
    announce 'Who are you??';
}

Switches

what_about (£name) {
    perhaps 'Ash':
        announce 'Hi Ash';
        splendid;
    perhaps 'Bex':
        announce 'Hi Bex';
        splendid;
    on_the_off_chance:
        throw new Wobbly('Who the hell are you!');
        splendid;
}

Foreach loops

merry_go_round (['a', 'b', 'c'] as £item) {
    announce £item;
}

Try/Catch blocks

would_you_mind {
    // Thingy
} actually_i_do_mind(Wobbly £error) {
    echo £error->getMessage();
}

Classes

upper_class Example {
    state £a;
    private £b;
    hereditary £c;
}

Super Globals

£_BISCUIT // $_COOKIE
£_ROYAL_MAIL // $_POST
£_BUTLER // $_SERVER

Misc

serve_biscuit('name', 'content'); // setcookie();
perish(); // die();
brexit(); // exit();
does_the_array_contain(); // in_array();

About

PHP the way god intended.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages