Skip to content

Bump to 0.5.1, with dependencies and document updated. #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,23 @@ jobs:
override: true
components: clippy

- name: Cargo generate lockfile
uses: actions-rs/cargo@v1
with:
toolchain: stable
command: generate-lockfile

- name: Setup cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}-ci-${{ matrix.php-version }}-${{ hashFiles('**/Cargo.lock') }}

- name: Cargo fmt
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -159,6 +176,23 @@ jobs:
toolchain: stable
override: true

- name: Cargo generate lockfile
uses: actions-rs/cargo@v1
with:
toolchain: stable
command: generate-lockfile

- name: Setup cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}-check-${{ matrix.php-version }}-${{ matrix.features }}-${{ hashFiles('**/Cargo.lock') }}

- name: Cargo check phper-sys
uses: actions-rs/cargo@v1
with:
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ The framework that allows us to write PHP extensions using pure and safe Rust wh
}
```

1. Create the `build.rs` ( Adapting MacOS ).

```rust,no_run
fn main() {
#[cfg(target_os = "macos")]
{
println!("cargo:rustc-link-arg=-undefined");
println!("cargo:rustc-link-arg=dynamic_lookup");
}
}
```

1. Write you owned extension logic in `lib.rs`.

```rust
Expand Down Expand Up @@ -125,6 +137,10 @@ The framework that allows us to write PHP extensions using pure and safe Rust wh

See [examples](https://github.com/phper-framework/phper/tree/master/examples).

## The projects using PHPER

- [apache/skywalking-php](https://github.com/apache/skywalking-php) - The PHP Agent for Apache SkyWalking, which provides the native tracing abilities for PHP project.

## License

[MulanPSL-2.0](https://github.com/phper-framework/phper/blob/master/LICENSE).
6 changes: 3 additions & 3 deletions examples/hello/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ path = "src/_reexport.rs"
crate-type = ["cdylib"]

[dependencies]
phper = { version = "0.5.0", path = "../../phper" }
phper = { version = "0.5.1", path = "../../phper" }

[dev-dependencies]
phper-test = { version = "0.5.0", path = "../../phper-test" }
phper-test = { version = "0.5.1", path = "../../phper-test" }

[build-dependencies]
phper-build = { version = "0.5.0", path = "../../phper-build" }
phper-build = { version = "0.5.1", path = "../../phper-build" }
4 changes: 2 additions & 2 deletions examples/http-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ crate-type = ["cdylib"]
anyhow = "1.0.58"
bytes = "1.1.0"
indexmap = "1.9.1"
phper = { version = "0.5.0", path = "../../phper" }
phper = { version = "0.5.1", path = "../../phper" }
reqwest = { version = "0.11.11", features = ["blocking", "cookies"] }
thiserror = "1.0.31"

[dev-dependencies]
phper-test = { version = "0.5.0", path = "../../phper-test" }
phper-test = { version = "0.5.1", path = "../../phper-test" }
4 changes: 2 additions & 2 deletions examples/http-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ crate-type = ["cdylib"]

[dependencies]
hyper = { version = "0.14.20", features = ["http1", "runtime", "server"] }
phper = { version = "0.5.0", path = "../../phper" }
phper = { version = "0.5.1", path = "../../phper" }
thiserror = "1.0.31"
tokio = { version = "1.19.2", features = ["full"] }

[dev-dependencies]
phper-test = { version = "0.5.0", path = "../../phper-test" }
phper-test = { version = "0.5.1", path = "../../phper-test" }
reqwest = "0.11.11"
6 changes: 3 additions & 3 deletions examples/logging/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ crate-type = ["cdylib"]

[dependencies]
anyhow = "1.0.58"
phper = { version = "0.5.0", path = "../../phper" }
phper = { version = "0.5.1", path = "../../phper" }

[dev-dependencies]
phper-test = { version = "0.5.0", path = "../../phper-test" }
phper-test = { version = "0.5.1", path = "../../phper-test" }

[build-dependencies]
phper-build = { version = "0.5.0", path = "../../phper-build" }
phper-build = { version = "0.5.1", path = "../../phper-build" }
6 changes: 3 additions & 3 deletions phper-alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[package]
name = "phper-alloc"
version = "0.5.0"
version = "0.5.1"
authors = ["PHPER Framework Team", "jmjoy <[email protected]>"]
edition = "2021"
rust-version = "1.56"
Expand All @@ -22,7 +22,7 @@ keywords = ["php", "alloc"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
phper-sys = { version = "0.5.0", path = "../phper-sys" }
phper-sys = { version = "0.5.1", path = "../phper-sys" }

[build-dependencies]
phper-build = { version = "0.5.0", path = "../phper-build" }
phper-build = { version = "0.5.1", path = "../phper-build" }
4 changes: 2 additions & 2 deletions phper-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[package]
name = "phper-build"
version = "0.5.0"
version = "0.5.1"
authors = ["PHPER Framework Team", "jmjoy <[email protected]>"]
edition = "2021"
rust-version = "1.56"
Expand All @@ -22,4 +22,4 @@ keywords = ["php", "binding"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
phper-sys = { version = "0.5.0", path = "../phper-sys" }
phper-sys = { version = "0.5.1", path = "../phper-sys" }
2 changes: 1 addition & 1 deletion phper-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[package]
name = "phper-macros"
version = "0.5.0"
version = "0.5.1"
authors = ["PHPER Framework Team", "jmjoy <[email protected]>"]
edition = "2021"
rust-version = "1.56"
Expand Down
2 changes: 1 addition & 1 deletion phper-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[package]
name = "phper-sys"
version = "0.5.0"
version = "0.5.1"
authors = ["PHPER Framework Team", "jmjoy <[email protected]>"]
edition = "2021"
rust-version = "1.56"
Expand Down
6 changes: 3 additions & 3 deletions phper-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[package]
name = "phper-test"
version = "0.5.0"
version = "0.5.1"
authors = ["PHPER Framework Team", "jmjoy <[email protected]>"]
edition = "2021"
rust-version = "1.56"
Expand All @@ -25,10 +25,10 @@ keywords = ["php", "binding"]
fpm = ["fastcgi-client", "tokio/full"]

[dependencies]
fastcgi-client = { version = "0.7.0", optional = true }
fastcgi-client = { version = "0.8.0", optional = true }
libc = "0.2.126"
once_cell = "1.13.0"
phper-macros = { version = "0.5.0", path = "../phper-macros" }
phper-macros = { version = "0.5.1", path = "../phper-macros" }
tempfile = "3.3.0"
tokio = { version = "1.19.2", optional = true }

Expand Down
44 changes: 23 additions & 21 deletions phper-test/src/fpm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,40 +125,42 @@ pub fn test_fpm_request(
let local_addr = stream.local_addr().unwrap();
let peer_addr = stream.peer_addr().unwrap();
let local_ip = local_addr.ip().to_string();
let local_addr = local_addr.port().to_string();
let local_port = local_addr.port();
let peer_ip = peer_addr.ip().to_string();
let peer_port = peer_addr.port().to_string();
let peer_port = peer_addr.port();

let mut client = Client::new(stream, false);
let client = Client::new(stream);
let mut params = Params::default()
.set_request_method(method)
.set_script_name(request_uri)
.set_script_filename(script_filename)
.set_request_uri(request_uri)
.set_document_uri(script_name)
.set_remote_addr(&local_ip)
.set_remote_port(&local_addr)
.set_server_addr(&peer_ip)
.set_server_port(&peer_port)
.set_server_name("phper-test");
.request_method(method)
.script_name(request_uri)
.script_filename(script_filename)
.request_uri(request_uri)
.document_uri(script_name)
.remote_addr(&local_ip)
.remote_port(local_port)
.server_addr(&peer_ip)
.server_port(peer_port)
.server_name("phper-test");
if let Some(content_type) = &content_type {
params = params.set_content_type(content_type);
params = params.content_type(content_type);
}
let mut len = String::new();
if let Some(body) = &body {
len += &body.len().to_string();
params = params.set_content_length(&len);
params = params.content_length(body.len());
}

let response = if let Some(body) = body {
client.execute(Request::new(params, body.as_ref())).await
client
.execute_once(Request::new(params, body.as_ref()))
.await
} else {
client.execute(Request::new(params, &mut io::empty())).await
client
.execute_once(Request::new(params, &mut io::empty()))
.await
};

let output = response.unwrap();
let stdout = output.get_stdout().unwrap_or_default();
let stderr = output.get_stderr().unwrap_or_default();
let stdout = output.stdout.unwrap_or_default();
let stderr = output.stderr.unwrap_or_default();

let no_error = stderr.is_empty();

Expand Down
14 changes: 7 additions & 7 deletions phper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

[package]
name = "phper"
version = "0.5.0"
version = "0.5.1"
authors = ["PHPER Framework Team", "jmjoy <[email protected]>"]
edition = "2021"
rust-version = "1.56"
description = "The framework that allows us to write PHP extensions using pure and safe Rust whenever possible."
repository = "https://github.com/jmjoy/phper.git"
documentation = "https://docs.rs/phper"
license = "MulanPSL-2.0"
readme = "../README.md"
readme = "README.md"
keywords = ["php", "binding", "extension", "module"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -30,11 +30,11 @@ dashmap = "5.3.4"
derive_more = "0.99.17"
indexmap = "1.9.1"
once_cell = "1.13.0"
phper-alloc = { version = "0.5.0", path = "../phper-alloc" }
phper-macros = { version = "0.5.0", path = "../phper-macros" }
phper-sys = { version = "0.5.0", path = "../phper-sys" }
phper-alloc = { version = "0.5.1", path = "../phper-alloc" }
phper-macros = { version = "0.5.1", path = "../phper-macros" }
phper-sys = { version = "0.5.1", path = "../phper-sys" }
thiserror = "1.0.31"

[build-dependencies]
phper-build = { version = "0.5.0", path = "../phper-build" }
phper-sys = { version = "0.5.0", path = "../phper-sys" }
phper-build = { version = "0.5.1", path = "../phper-build" }
phper-sys = { version = "0.5.1", path = "../phper-sys" }
4 changes: 2 additions & 2 deletions tests/integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ crate-type = ["cdylib"]

[dependencies]
indexmap = "1.9.1"
phper = { version = "0.5.0", path = "../../phper" }
phper = { version = "0.5.1", path = "../../phper" }

[dev-dependencies]
phper-test = { version = "0.5.0", path = "../../phper-test", features = ["fpm"] }
phper-test = { version = "0.5.1", path = "../../phper-test", features = ["fpm"] }