Fork me on GitHub
Objective-PHP is a port of the Objective-C (or Objective-J runtime to PHP. This adds the language features of Objective-C nestled nicely inside the syntax of Objective-C. Moka is a port of the Apple Cocoa Frameworks (or Cappuccino).

Getting Started

Valid for Beta 1


Either use the zipball or tarball links above, or even better, clone the git repo:

Main Repo:


(Note: The objphp application is also an example of an Objective-PHP application).


Create a OBJPHP enviroment variable and set it to the path of your moka repo.

In Linux and MacOS X this can be done by adding

export OBJPHP = "<path>"

to your .profile file in your home folder. The running source ~/.profile .

You can optionally also set the following for the gen command of objphp:

Generate Project

In your chosen terminal have a read of the help for the objphp application.

./objphp -h

Then to see the list of target application types run

./objphp gen -l

At the moment there are 3 project types.

Choose your project type. If you just want a quick play with Objective-PHP choose console so you can run your application from the terminal.

./objphp gen -t=console ProjectName

where ProjectName is the name and path of the generated project.


Now open the main Objective-PHP file. For different applications this is different.

For console applications the file is called main.op , for web it is called AppController.op and for mvc FrontController.op.

Here are some important starting points.

For a primer on Objective-C in general see:

UnitTest and Compile

You can UnitTest you application by creating classes which are subclasses of UnitTest. Below is an example file example.op

@implementation example : UnitTest
- testMe
    echo "HI\n";

Any instance methods with test at the start of the method name will be called by the test framework, unless you specify which function to run. If you do specify a function to run DO NOT inclde the test prefix. See Below:

./objphp test example.op

will run all functions with the test prefix.

./objphp test example.op Me

would run the method testMe above.

When you are done building and testing with your application you will probably want to compile it to remove the parse overhead. This is acheived by doing

./objphp compile file.op -o=outputfile.php

Imported files should automatically be included into the output.


Currently deployment and compilation (above) are in early days, so at the moment you must simply copy the compiled file (the output .php file from the compilation stage) to your server/directory and name appropriately.


If you have any problems you can find me on the Google Group

Google Group:

and on twitter: stevediaconou

Document status: IN-PROGRESS for current version.