-
Notifications
You must be signed in to change notification settings - Fork 164
Getting started
Dmitriy Zayceff edited this page Apr 27, 2015
·
33 revisions
This is a simple way to try JPHP.
Before we start, you need to download the Gradle distributive and add the Gradle bin path to your PATH variable.
Create the next directories and files:
build.gradle
src/
JPHP-INF/
.bootstrap.php
launcher.conf
Change the gradle build file - build.gradle
:
apply plugin: 'application'
repositories {
jcenter()
mavenCentral()
}
sourceSets {
main.resources.srcDirs = ['src']
}
dependencies {
compile 'org.develnext:jphp-core:0.6+' // include jphp with runtime and compiler
compile 'org.develnext:jphp-zend-ext:0.6+' // legacy zend classes and functions
compile 'org.develnext:jphp-json-ext:0.6+' // json support
compile 'org.develnext:jphp-xml-ext:0.6+' // xml library
compile 'org.develnext:jphp-gdx-ext:0.6+' // libgdx wrapper
compile 'org.develnext:jphp-jsoup-ext:0.6+' // library for site parsing in jQuery style
}
mainClassName = 'php.runtime.launcher.Launcher'
In the JPHP-INF/.bootstrap.php
write any php code:
<?php echo "Hello World";
Use the command line to run your app:
gradle run
By default Launcher uses a special class loader to load your classes from the src directory, you still can use namespaces, for example - my\pack\AnyClass
will be loaded from the src/my/pack/AnyClass.php
file automatically.
The launcher uses an internal class loader to load your classes, it tries to find and load classes in classpath (resources).
JPHP Group 2015