Skip to content

Commit 87822e2

Browse files
authored
Remove cmd mod and adjust phper-test. (#74)
1 parent a4c8ab2 commit 87822e2

File tree

28 files changed

+124
-325
lines changed

28 files changed

+124
-325
lines changed

README.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,6 @@ The framework that allows us to write PHP extensions using pure and safe Rust wh
6868
phper = "<LATEST VERSION>"
6969
```
7070

71-
1. Add these code to `main.rs`.
72-
73-
```rust,no_run
74-
use phper::cmd::make;
75-
76-
fn main() {
77-
make();
78-
}
79-
```
80-
8171
1. Create the `build.rs` ( Adapting MacOS ).
8272

8373
```rust,no_run
@@ -98,7 +88,7 @@ The framework that allows us to write PHP extensions using pure and safe Rust wh
9888
#[php_get_module]
9989
pub fn get_module() -> Module {
10090
let mut module = Module::new(
101-
env!("CARGO_PKG_NAME"),
91+
env!("CARGO_CRATE_NAME"),
10292
env!("CARGO_PKG_VERSION"),
10393
env!("CARGO_PKG_AUTHORS"),
10494
);
@@ -119,10 +109,7 @@ The framework that allows us to write PHP extensions using pure and safe Rust wh
119109
cargo build --release
120110

121111
# Install to php extension path.
122-
cargo run --release -- install
123-
# Or if you install php globally, you should use sudo.
124-
# sudo ./target/release/myapp install
125-
112+
cp target/release/libmyapp.so `${PHP_CONFIG:=php-config} --extension-dir`
126113
```
127114

128115
1. Edit your `php.ini`, add the below line.

examples/hello/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ cargo test --release
2424
## Install
2525

2626
```bash
27-
cargo run --release -- install
27+
cp target/release/libhello.so `${PHP_CONFIG:=php-config} --extension-dir`
2828
```
2929

3030
## License

examples/hello/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn throw_exception(_: &mut [ZVal]) -> phper::Result<()> {
3434
#[php_get_module]
3535
pub fn get_module() -> Module {
3636
let mut module = Module::new(
37-
env!("CARGO_PKG_NAME"),
37+
env!("CARGO_CRATE_NAME"),
3838
env!("CARGO_PKG_VERSION"),
3939
env!("CARGO_PKG_AUTHORS"),
4040
);

examples/hello/src/main.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/hello/tests/integration.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@
88
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
99
// See the Mulan PSL v2 for more details.
1010

11-
use phper_test::{cli::test_php_scripts_with_lib, utils::get_lib_path};
12-
use std::{env, path::Path};
11+
use phper_test::{cli::test_php_scripts, utils::get_lib_path};
12+
use std::{
13+
env,
14+
path::{Path, PathBuf},
15+
};
1316

1417
#[test]
1518
fn test_php() {
16-
test_php_scripts_with_lib(
17-
get_lib_path(env!("CARGO_BIN_EXE_hello")),
19+
test_php_scripts(
20+
get_lib_path(
21+
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
22+
.join("..")
23+
.join("..")
24+
.join("target"),
25+
"hello",
26+
),
1827
&[&Path::new(env!("CARGO_MANIFEST_DIR"))
1928
.join("tests")
2029
.join("php")

examples/http-client/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ cargo test --release
2626
## Install
2727

2828
```bash
29-
cargo run --release -- install
29+
cp target/release/libhttp_client.so `${PHP_CONFIG:=php-config} --extension-dir`
3030
```
3131

3232
## License

examples/http-client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub mod utils;
2525
#[php_get_module]
2626
pub fn get_module() -> Module {
2727
let mut module = Module::new(
28-
env!("CARGO_PKG_NAME"),
28+
env!("CARGO_CRATE_NAME"),
2929
env!("CARGO_PKG_VERSION"),
3030
env!("CARGO_PKG_AUTHORS"),
3131
);

examples/http-client/src/main.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/http-client/tests/integration.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@
88
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
99
// See the Mulan PSL v2 for more details.
1010

11-
use phper_test::{cli::test_php_scripts_with_lib, utils::get_lib_path};
12-
use std::{env, path::Path};
11+
use phper_test::{cli::test_php_scripts, utils::get_lib_path};
12+
use std::{
13+
env,
14+
path::{Path, PathBuf},
15+
};
1316

1417
#[test]
1518
fn test_php() {
16-
test_php_scripts_with_lib(
17-
get_lib_path(env!("CARGO_BIN_EXE_http-client")),
19+
test_php_scripts(
20+
get_lib_path(
21+
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
22+
.join("..")
23+
.join("..")
24+
.join("target"),
25+
"http_client",
26+
),
1827
&[&Path::new(env!("CARGO_MANIFEST_DIR"))
1928
.join("tests")
2029
.join("php")

examples/http-server/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ cargo test --release
2626
## Install
2727

2828
```bash
29-
cargo run --release -- install
29+
cp target/release/libhttp_server.so `${PHP_CONFIG:=php-config} --extension-dir`
3030
```
3131

3232
## License

0 commit comments

Comments
 (0)