Skip to content

Commit 107d40b

Browse files
authored
Merge pull request #10 from jmjoy/0.2.0-alpha.2-dev
2 parents 851b06e + 8bbe7db commit 107d40b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+960
-408
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
os:
2222
- ubuntu-latest
2323
php-version:
24-
- "7.0"
24+
# - "7.0"
2525
- "7.1"
2626
- "7.2"
2727
- "7.3"

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ members = [
99

1010
# internal
1111
"examples/hello",
12-
"examples/log",
1312
"examples/http-client",
13+
"examples/logging",
1414
"tests/integration",
1515
]

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# PHPer
22

33
[![crates](https://img.shields.io/crates/v/phper?style=flat-square)](https://crates.io/crates/phper)
4-
[![](https://img.shields.io/docsrs/phper?style=flat-square)](https://docs.rs/phper)
4+
[![docs](https://img.shields.io/docsrs/phper?style=flat-square)](https://docs.rs/phper)
55

66
A library that allows us to write PHP extensions using pure Rust and using safe Rust whenever possible.
77

@@ -17,35 +17,35 @@ A library that allows us to write PHP extensions using pure Rust and using safe
1717

1818
**os**
1919

20-
-[x] linux
21-
-[ ] macos
22-
-[ ] windows
20+
- [x] linux
21+
- [ ] macos
22+
- [ ] windows
2323

2424
**php**
2525

2626
*version*
2727

28-
-[x] 7.0
29-
-[x] 7.1
30-
-[x] 7.2
31-
-[x] 7.3
32-
-[x] 7.4
33-
-[x] 8.0
28+
- [ ] 7.0
29+
- [x] 7.1
30+
- [x] 7.2
31+
- [x] 7.3
32+
- [x] 7.4
33+
- [x] 8.0
3434

3535
*mode*
3636

37-
-[x] nts
38-
-[ ] zts
37+
- [x] nts
38+
- [ ] zts
3939

4040
*sapi*
4141

42-
-[x] cli
43-
-[ ] fpm
42+
- [x] cli
43+
- [ ] fpm
4444

4545
*debug*
4646

47-
-[x] disable
48-
-[ ] enable
47+
- [x] disable
48+
- [ ] enable
4949

5050
## Usage
5151

examples/hello/src/lib.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use phper::{
2-
alloc::EBox,
32
arrays::Array,
4-
classes::StdClass,
3+
classes::DynamicClass,
54
functions::Argument,
65
ini::Policy,
76
modules::{Module, ModuleArgs},
@@ -57,26 +56,26 @@ pub fn get_module() -> Module {
5756
let hello_description = Val::new(Module::get_str_ini("hello.description"));
5857
arr.insert("hello.description", hello_description);
5958

60-
EBox::new(arr)
59+
arr
6160
},
6261
vec![],
6362
);
6463

6564
// register classes
66-
let mut foo_class = StdClass::new();
65+
let mut foo_class = DynamicClass::new();
6766
foo_class.add_property("foo", "100".to_string());
6867
foo_class.add_method(
6968
"getFoo",
70-
|this: &mut Object, _: &mut [Val]| -> phper::Result<Val> {
69+
|this: &mut Object<()>, _: &mut [Val]| -> phper::Result<Val> {
7170
let prop = this.get_property("foo");
7271
Ok(Val::new(prop.as_string_value()?))
7372
},
7473
vec![],
7574
);
7675
foo_class.add_method(
7776
"setFoo",
78-
|this: &mut Object, arguments: &mut [Val]| -> phper::Result<()> {
79-
this.set_property("foo", arguments[0].as_string_value()?);
77+
|this: &mut Object<()>, arguments: &mut [Val]| -> phper::Result<()> {
78+
this.set_property("foo", Val::new(arguments[0].as_string_value()?));
8079
Ok(())
8180
},
8281
vec![Argument::by_val("foo")],

examples/hello/tests/php/test.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66

77
assert_eq(hello_say_hello("world"), "Hello, world!\n");
88

9-
assert_eq(class_exists("Phper\\OtherException"), true);
10-
119
try {
1210
hello_throw_exception();
13-
} catch (Phper\OtherException $e) {
11+
} catch (ErrorException $e) {
1412
assert_eq($e->getMessage(), "I am sorry");
1513
}
1614

examples/http-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "mini-curl"
2+
name = "http-client"
33
version = "0.0.0"
44
authors = ["jmjoy <918734043@qq.com>"]
55
edition = "2018"

examples/http-client/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use phper::{classes::StdClass, modules::Module, php_get_module};
1+
use phper::{classes::DynamicClass, modules::Module, php_get_module};
22

33
pub mod http_client;
44

@@ -11,7 +11,7 @@ pub fn get_module() -> Module {
1111
);
1212

1313
// let client = HttpClient::new();
14-
let client_class = StdClass::new();
14+
let client_class: DynamicClass<()> = DynamicClass::new();
1515
module.add_class("HttpClient", client_class);
1616

1717
module

examples/log/Cargo.toml renamed to examples/logging/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "log"
2+
name = "logging"
33
version = "0.0.0"
44
authors = ["jmjoy <918734043@qq.com>"]
55
edition = "2018"
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)