Skip to content

Commit 87c3fd8

Browse files
committed
Fixing comments
1 parent 51778d8 commit 87c3fd8

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,24 @@ JavaPHP is a lightweight Java library that permits to execute PHP code into Java
44
you can just use PHP and execute it as a part of your existing Java code, does not rely on any dependencies, its fully standalone,
55
and you can use it in a compiled .jar file or in a simple .java file without having to compile it
66

7+
Fun fact: this library was made in like 1 day because i had no other ideas and i was bored so yeah, now this library exists.
8+
79
### Features
810
- PHP file execution in java
911
- Customizable error handling
1012

13+
There are not alot of features because i keep it very simple, why would i do a lot of features since its focused only on the purpose of executing PHP in Java.
14+
1115
### How to use
1216
Simply import it to your file and do like this:
17+
1318
```java
1419
import java.io.File;
1520
import java.util.HashMap;
1621
import java.util.Map;
1722

23+
import fr.breadeater.JavaPHP;
24+
1825
public class Main {
1926
public static void main(String[] args) throws Throwable {
2027
JavaPHP javaphp = new JavaPHP(false);
@@ -33,10 +40,8 @@ public class Main {
3340
```
3441

3542
### Installation
36-
Simply download the .jar / .java file from the repository Releases and import it in your project
37-
38-
To import the .java file, simply drag it into your project folder.<br>
39-
To import the .jar file, simply use Maven / Gradle and add new dependency to your configuration that points to the .jar file
43+
Simply download the .jar / .java file from the repository Releases and import it in your project.<br>
44+
For Maven or Gradle, add it to your local repository.
4045

4146
### Contribution
4247
You can contribute as much as you want, the conditions:
@@ -50,5 +55,4 @@ You can contribute as much as you want, the conditions:
5055
You can contact me via [mail](mailto:contact@breadeater.fr) or send message in the discussions of the repository
5156

5257
### License
53-
5458
This project is licensed under the MIT license, see [LICENSE](./LICENSE) for more infos.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<configuration>
2222
<archive>
2323
<manifest>
24-
<mainClass>fr.breadeater.Main</mainClass>
24+
<mainClass>fr.breadeater.JavaPHP</mainClass>
2525
</manifest>
2626
</archive>
2727
<descriptorRefs>

src/main/java/fr/breadeater/JavaPHP.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,26 @@
66
import java.util.function.Consumer;
77

88
public class JavaPHP {
9+
private Consumer<String> ERR_CALLBACK;
10+
911
private final String PHP_BIN_PATH;
1012
private final boolean NO_PHP_WARN;
1113

1214
private Map<String, String> env_vars;
1315
private String response = null;
1416

15-
private Consumer<String> ERR_CALLBACK;
16-
1717
/**
18-
* Creates a PHPJava instance
18+
* Creates a JavaPHP instance
1919
* @param php_bin_path PHP binary file path (e.g /usr/bin/php)
20+
* @param ignorePHPWarnings Specifies if PHP Warning and PHP Startup errors should be ignored
2021
*/
2122
public JavaPHP(String php_bin_path, boolean ignorePHPWarnings){
2223
this.PHP_BIN_PATH = php_bin_path;
2324
this.NO_PHP_WARN = ignorePHPWarnings;
2425
}
2526

2627
/**
27-
* Creates a PHPJava instance
28+
* Creates a JavaPHP instance
2829
* @param ignorePHPWarnings Specifies if PHP Warning and PHP Startup errors should be ignored
2930
*/
3031
public JavaPHP(boolean ignorePHPWarnings){
@@ -33,7 +34,7 @@ public JavaPHP(boolean ignorePHPWarnings){
3334
}
3435

3536
/**
36-
* Creates a PHPJava instance
37+
* Creates a JavaPHP instance
3738
*/
3839
public JavaPHP(){
3940
this.PHP_BIN_PATH = "php";
@@ -43,8 +44,9 @@ public JavaPHP(){
4344
/**
4445
* Sets PHP global variables like REQUEST_METHOD, REQUEST_ADDR, etc...<br>
4546
* See <a href="https://www.php.net/manual/en/reserved.variables.php">PHP global variables</a> for other examples.<br><br>
46-
*
4747
* WARNING: THIS IS REQUIRED IF USING $_SERVER VARIABLES OR OTHERS !
48+
*
49+
* @param variables The PHP global variables
4850
*/
4951
public void setPHPVars(Map<String, String> variables){
5052
this.env_vars = variables;

src/main/java/fr/breadeater/Main.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
public class Main {
1212
public static void main(String[] args) throws Throwable {
13-
/*
1413
JavaPHP javaphp = new JavaPHP(false);
1514
Map<String, String> env = new HashMap<>();
1615

@@ -22,6 +21,5 @@ public static void main(String[] args) throws Throwable {
2221
javaphp.run(new File("./test.php").getAbsolutePath());
2322

2423
System.out.println(javaphp.getResult());
25-
*/
2624
}
2725
}

0 commit comments

Comments
 (0)