mirror of
https://github.com/danog/ext-php-rs.git
synced 2024-11-30 04:39:04 +01:00
Release v0.7.0
This commit is contained in:
parent
6df362b714
commit
fa05703c08
17
CHANGELOG.md
17
CHANGELOG.md
@ -1,5 +1,22 @@
|
||||
# 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
|
||||
|
||||
- Reorganized project. [#101]
|
||||
|
@ -5,7 +5,7 @@ repository = "https://github.com/davidcole1340/ext-php-rs"
|
||||
homepage = "https://github.com/davidcole1340/ext-php-rs"
|
||||
license = "MIT OR Apache-2.0"
|
||||
keywords = ["php", "ffi", "zend"]
|
||||
version = "0.6.0"
|
||||
version = "0.7.0"
|
||||
authors = ["David Cole <david.cole1340@gmail.com>"]
|
||||
edition = "2018"
|
||||
categories = ["api-bindings"]
|
||||
@ -14,7 +14,7 @@ exclude = ["/.github", "/.crates", "/guide"]
|
||||
[dependencies]
|
||||
bitflags = "1.2.1"
|
||||
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]
|
||||
bindgen = { version = "0.59" }
|
||||
|
38
README.md
38
README.md
@ -12,6 +12,11 @@ Export a simple function `function hello_world(string $name): string` to PHP:
|
||||
```rust
|
||||
use ext_php_rs::prelude::*;
|
||||
|
||||
/// Gives you a nice greeting!
|
||||
///
|
||||
/// @param string $name Your name.
|
||||
///
|
||||
/// @return string Nice greeting!
|
||||
#[php_function]
|
||||
pub fn hello_world(name: String) -> String {
|
||||
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:
|
||||
|
||||
```php
|
||||
@ -33,6 +69,8 @@ var_dump(hello_world("David")); // string(13) "Hello, David!"
|
||||
For more examples read the library
|
||||
[guide](https://davidcole1340.github.io/ext-php-rs/guide).
|
||||
|
||||
[`cargo-php`]: https://crates.io/crates/cargo-php
|
||||
|
||||
## Features
|
||||
|
||||
- **Easy to use:** The built-in macros can abstract away the need to interact
|
||||
|
@ -11,7 +11,7 @@ edition = "2018"
|
||||
categories = ["api-bindings", "command-line-interface"]
|
||||
|
||||
[dependencies]
|
||||
ext-php-rs = { version = "0.6", path = "../../" }
|
||||
ext-php-rs = { version = "0.7", path = "../../" }
|
||||
|
||||
clap = "3.0.0-beta.5"
|
||||
anyhow = "1"
|
||||
|
@ -4,7 +4,7 @@ description = "Derive macros for ext-php-rs."
|
||||
repository = "https://github.com/davidcole1340/ext-php-rs"
|
||||
homepage = "https://github.com/davidcole1340/ext-php-rs"
|
||||
license = "MIT OR Apache-2.0"
|
||||
version = "0.6.0"
|
||||
version = "0.7.0"
|
||||
authors = ["David Cole <david.cole1340@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user