Release v0.7.0

This commit is contained in:
David Cole 2021-11-20 14:33:41 +13:00
parent 6df362b714
commit fa05703c08
5 changed files with 60 additions and 5 deletions

View File

@ -1,5 +1,22 @@
# Changelog # Changelog
## Version 0.7.0
- Disabled serialization and unserialization of Rust structs exported as PHP
classes. [#105]
- You can't serialize an associated Rust struct so this would have never
worked, but disabling them fixes crashes when running in an environment like
psysh.
- Replaced boxed module inside `ModuleBuilder` with in-struct module.
- Fixed builds failing on Linux AArch64 systems. [#106]
- Added `cargo-php` for creating stubs, installing and uninstalling extensions.
[#107]
- Check out the guide for more information on this.
[#105]: https://github.com/davidcole1340/ext-php-rs/pull/105
[#106]: https://github.com/davidcole1340/ext-php-rs/pull/106
[#107]: https://github.com/davidcole1340/ext-php-rs/pull/107
## Version 0.6.0 ## Version 0.6.0
- Reorganized project. [#101] - Reorganized project. [#101]

View File

@ -5,7 +5,7 @@ repository = "https://github.com/davidcole1340/ext-php-rs"
homepage = "https://github.com/davidcole1340/ext-php-rs" homepage = "https://github.com/davidcole1340/ext-php-rs"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
keywords = ["php", "ffi", "zend"] keywords = ["php", "ffi", "zend"]
version = "0.6.0" version = "0.7.0"
authors = ["David Cole <david.cole1340@gmail.com>"] authors = ["David Cole <david.cole1340@gmail.com>"]
edition = "2018" edition = "2018"
categories = ["api-bindings"] categories = ["api-bindings"]
@ -14,7 +14,7 @@ exclude = ["/.github", "/.crates", "/guide"]
[dependencies] [dependencies]
bitflags = "1.2.1" bitflags = "1.2.1"
parking_lot = "0.11.2" parking_lot = "0.11.2"
ext-php-rs-derive = { version = "=0.6.0", path = "./crates/macros" } ext-php-rs-derive = { version = "=0.7.0", path = "./crates/macros" }
[build-dependencies] [build-dependencies]
bindgen = { version = "0.59" } bindgen = { version = "0.59" }

View File

@ -12,6 +12,11 @@ Export a simple function `function hello_world(string $name): string` to PHP:
```rust ```rust
use ext_php_rs::prelude::*; use ext_php_rs::prelude::*;
/// Gives you a nice greeting!
///
/// @param string $name Your name.
///
/// @return string Nice greeting!
#[php_function] #[php_function]
pub fn hello_world(name: String) -> String { pub fn hello_world(name: String) -> String {
format!("Hello, {}!", name) format!("Hello, {}!", name)
@ -24,6 +29,37 @@ pub fn module(module: ModuleBuilder) -> ModuleBuilder {
} }
``` ```
Use [`cargo-php`] to build IDE stubs and install the extension:
```text
$ cargo install cargo-php
Installing cargo-php v0.1.0
$ cargo php stubs --stdout
Compiling example-ext v0.1.0
Finished dev [unoptimized + debuginfo] target(s) in 3.57s
<?php
// Stubs for example-ext
/**
* Gives you a nice greeting!
*
* @param string $name Your name.
*
* @return string Nice greeting!
*/
function hello_world(string $name): string {}
$ cargo php install --release
Compiling example-ext v0.1.0
Finished release [optimized] target(s) in 1.68s
Are you sure you want to install the extension `example-ext`? yes
$ php -m
[PHP Modules]
// ...
example-ext
// ...
```
Calling the function from PHP: Calling the function from PHP:
```php ```php
@ -33,6 +69,8 @@ var_dump(hello_world("David")); // string(13) "Hello, David!"
For more examples read the library For more examples read the library
[guide](https://davidcole1340.github.io/ext-php-rs/guide). [guide](https://davidcole1340.github.io/ext-php-rs/guide).
[`cargo-php`]: https://crates.io/crates/cargo-php
## Features ## Features
- **Easy to use:** The built-in macros can abstract away the need to interact - **Easy to use:** The built-in macros can abstract away the need to interact

View File

@ -11,10 +11,10 @@ edition = "2018"
categories = ["api-bindings", "command-line-interface"] categories = ["api-bindings", "command-line-interface"]
[dependencies] [dependencies]
ext-php-rs = { version = "0.6", path = "../../" } ext-php-rs = { version = "0.7", path = "../../" }
clap = "3.0.0-beta.5" clap = "3.0.0-beta.5"
anyhow = "1" anyhow = "1"
dialoguer = "0.9" dialoguer = "0.9"
libloading = "0.7" libloading = "0.7"
cargo_metadata = "0.14" cargo_metadata = "0.14"

View File

@ -4,7 +4,7 @@ description = "Derive macros for ext-php-rs."
repository = "https://github.com/davidcole1340/ext-php-rs" repository = "https://github.com/davidcole1340/ext-php-rs"
homepage = "https://github.com/davidcole1340/ext-php-rs" homepage = "https://github.com/davidcole1340/ext-php-rs"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
version = "0.6.0" version = "0.7.0"
authors = ["David Cole <david.cole1340@gmail.com>"] authors = ["David Cole <david.cole1340@gmail.com>"]
edition = "2018" edition = "2018"