Skip to content

Commit 5f7bd7a

Browse files
authored
Merge pull request #31 from chitoku-k/patch-1
Update README.md
2 parents 48343cc + 38fa3ab commit 5f7bd7a

File tree

1 file changed

+41
-42
lines changed

1 file changed

+41
-42
lines changed

README.md

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<p align="center"><img src="./docs/img/phpjava.jpg" height="300"></p>
88

99
# What is the PHPJava?
10-
The PHPJava is experimental library which emulate JVM (a.k.a. Java Virtual Machine) by PHP 🐘
11-
The PHPJava proceed to read binary from pre-compiled Java file(s) ☕
12-
This project reference to [Java Virtual Machine Specification](https://docs.oracle.com/javase/specs/jvms/se11/html/index.html) documentation when We makes.
10+
The PHPJava is an experimental library which emulates JVM (a.k.a. Java Virtual Machine) by PHP 🐘
11+
The PHPJava reads binary from pre-compiled Java file(s) ☕
12+
This project referred to [Java Virtual Machine Specification](https://docs.oracle.com/javase/specs/jvms/se11/html/index.html) documentation at the time we made it.
1313

14-
We welcoming to contributions this project 💪
14+
We are welcoming any contributions to this project 💪
1515

1616
## Requirements
1717
- PHP >= 7.2
@@ -27,12 +27,12 @@ Sorry, I do not have enough time (T_T)
2727
- etc...
2828

2929
## Quick start
30-
- 1) Install the PHPJava into your project.
30+
- 1) Install the PHPJava into your project:
3131
```
3232
$ composer require memory-agape/php-java
3333
```
3434

35-
- 2) Write Java
35+
- 2) Write Java:
3636
```java
3737
class HelloWorld
3838
{
@@ -43,12 +43,12 @@ class HelloWorld
4343
}
4444
```
4545

46-
- 3) Compile Java
46+
- 3) Compile Java:
4747
```
4848
$ javac -UTF8 /path/to/HelloWorld.java
4949
```
5050

51-
- 4) Call to main method as following.
51+
- 4) Call the main method as follows:
5252

5353
```php
5454
<?php
@@ -65,21 +65,21 @@ use PHPJava\Core\JavaClassFileReader;
6565
);
6666
```
6767

68-
- 5) Get a result
68+
- 5) Get the result
6969
```
7070
$ php /path/to/HelloWorld.php
7171
Hello World
7272
```
7373

7474
## Java Archive (Execute to *.jar file)
7575

76-
- 1) Build your java files to class. Building example is below.
76+
- 1) Build your Java files to class. An example is shown below:
7777
```
7878
$ javac -encoding UTF8 -d build src/*
7979
$ cd build && jar -cvfe ../Test.jar Test *
8080
```
8181

82-
- 2) execute jar on PHPJava with enrtypoint or your targeted method.
82+
- 2) Execute jar on PHPJava with either an enrtypoint or your targeted method.
8383
```php
8484
<?php
8585
use PHPJava\Core\JavaArchive;
@@ -98,9 +98,9 @@ use PHPJava\Core\JavaArchive;
9898
);
9999
```
100100

101-
### Get/Set a static fields
101+
### Get/Set static fields
102102

103-
- ex) Set or Get a static fields as follows.
103+
- ex) Set or Get static fields as follows:
104104

105105
```php
106106
<?php
@@ -119,9 +119,9 @@ $staticFieldAccessor->set('fieldName', 'value');
119119
echo $staticFieldAccessor->get('fieldName');
120120
```
121121

122-
### Call to a static method
122+
### Call a static method
123123

124-
- ex) Call to static method as follows.
124+
- ex) Call a static method as follows:
125125

126126
```php
127127
<?php
@@ -158,10 +158,10 @@ echo $result;
158158
```
159159

160160

161-
### Get/Set a dynamic fields
162-
If you want to get/set dynamic fields, you need call to `construct` method on Java by PHPJava.
161+
### Get/Set dynamic fields
162+
If you want to get/set dynamic fields, you need to call the `construct` method on Java by PHPJava.
163163

164-
- ex) Call dynamic field as following.
164+
- ex) Call dynamic field as follows:
165165

166166
```php
167167
<?php
@@ -184,10 +184,10 @@ $dynamicFieldAccessor->set('fieldName', 'value');
184184
echo $dynamicFieldAccessor->get('fieldName');
185185
```
186186

187-
### Call to a dynamic method
188-
If you want to get/set dynamic method (same as field), you need call to `construct` method on Java by PHPJava.
187+
### Call a dynamic method
188+
If you want to get/set dynamic method (same as a field), you need to call the `construct` method on Java by PHPJava.
189189

190-
- ex) Call dynamic method as following.
190+
- ex) Call dynamic method as follows:
191191

192192
```php
193193
<?php
@@ -225,7 +225,7 @@ echo $result;
225225

226226
### Output PHPJava operations
227227

228-
- Output debug trace as following if you want to show operated log.
228+
- Output debug trace as follows if you want to show operation log:
229229

230230
```php
231231
<?php
@@ -247,7 +247,7 @@ $javaClass
247247
$javaClass->debug();
248248
```
249249

250-
- Outputted debug trace is below.
250+
- Output debug trace is shown below:
251251

252252
```
253253
[method]
@@ -279,22 +279,22 @@ public static void main(java.lang.String[])
279279
---------+--------+----------------------+------------+-----------------
280280
```
281281

282-
- **[method]** is showing called method.
283-
- **[code]** is showing JVM's real programs.
284-
- **[executed]** is showing executed programs.
285-
- **PC** is showing Program Counter.
286-
- **OPCODE** is showing Operation Codes.
287-
- **MNEMONIC** is naming Operation Codes.
288-
- **OPERANDS** is showing stacked items on memory.
289-
- **LOCAL STORAGE** is showing stacked items on a method.
282+
- **[method]** shows the called method.
283+
- **[code]** shows the JVM's real programs.
284+
- **[executed]** shows the executed programs.
285+
- **PC** shows the Program Counter.
286+
- **OPCODE** shows the Operation Codes.
287+
- **MNEMONIC** shows the names of the Operation Codes.
288+
- **OPERANDS** shows the stacked items on memory.
289+
- **LOCAL STORAGE** shows the stacked items on a method.
290290

291291
## PHP problems
292-
- **Problem 1:** The PHP is cannot calculating big numbers because of PHP is different to the Java.
293-
But the PHPJava use `bcmath` functions and `gmp` functions to a certain extent to cover to calculate.
294-
The PHPJava return valued is mixed why therefore We recommend to cast to `string` on the PHPJava.
292+
- **Problem 1:** PHP cannot calculate big numbers because PHP is different from Java.
293+
But PHPJava uses `bcmath` functions and `gmp` functions to a certain extent to cover such calculations.
294+
Therefore, PHPJava returns a mixed value and we recommend to cast them to `string` on PHPJava.
295295

296-
- **Problem 2:** The PHPJava cannot cover to Java's types completely because of PHP is different to the Java.
297-
The Java and the PHPJava comparison table is below.
296+
- **Problem 2:** PHPJava cannot completely cover Java types because PHP is different from Java.
297+
The comparison table of Java and PHPJava is shown below:
298298

299299
|Java |PHPJava |
300300
|:-------------:|:-------------:|
@@ -308,23 +308,22 @@ public static void main(java.lang.String[])
308308
|float |\PHPJava\Kernel\Types\\_Float (including `__toString`), string, float |
309309
|double |\PHPJava\Kernel\Types\\_Char (including `__toString`), string, float |
310310

311-
- **Problem 3:** The PHPJava cannot calculate big numbered `double` and `float` values because of `gmp_pow` cannot calculate negative exponents.
312-
So the PHPJava use built-in functions which is `pow`.
311+
- **Problem 3:** PHPJava cannot calculate big number of `double` and `float` because `gmp_pow` cannot calculate negative exponents. So, PHPJavas use built-in function `pow`.
313312

314313
## Run unit tests
315314

316-
- PHPUnit test is below.
315+
- To run a PHPUnit test:
317316
```
318317
$ ./vendor/bin/phpunit tests
319318
```
320319

321-
- PHP Coding standards testing is below.
320+
- To run PHP Coding standards test:
322321

323322
```
324323
$ ./vendor/bin/phpcs --standard=phpcs.xml src
325324
```
326325

327-
- All testing is below.
326+
- To run all tests:
328327

329328
```
330329
$ composer run tests
@@ -334,4 +333,4 @@ $ composer run tests
334333
- [Java Virtual Machine Specification](https://docs.oracle.com/javase/specs/jvms/se11/html/index.html)
335334

336335
## License
337-
MIT
336+
MIT

0 commit comments

Comments
 (0)