Skip to content

Commit e22bd3f

Browse files
committed
Update README.
1 parent 0b5f8e3 commit e22bd3f

File tree

1 file changed

+76
-76
lines changed

1 file changed

+76
-76
lines changed

README.md

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ A library that allows us to write PHP extensions using pure Rust and using safe
2121
### Tested Support
2222

2323
- **OS**
24-
- [x] linux
25-
- [ ] macos
26-
- [ ] windows
24+
- [x] linux
25+
- [ ] macos
26+
- [ ] windows
2727
- **PHP**
2828
- **version**
2929
- [x] 7.0
@@ -47,79 +47,79 @@ A library that allows us to write PHP extensions using pure Rust and using safe
4747

4848
1. Make sure `libclang` and `php` is installed.
4949

50-
```bash
51-
# If you are using debian like linux system:
52-
sudo apt install llvm-10-dev libclang-10-dev php-cli
53-
```
54-
55-
2. Create you cargo project, suppose your application is called myapp.
56-
57-
```bash
58-
cargo new myapp
59-
```
60-
61-
3. Add the dependencies and metadata to you Cargo project.
62-
63-
```toml
64-
[lib]
65-
crate-type = ["cdylib"]
66-
67-
[dependencies]
68-
phper = "0.3"
69-
```
70-
71-
4. 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-
81-
5. Write you owned extension logic in `lib.rs`.
82-
83-
```rust
84-
use phper::{php_get_module, modules::Module};
85-
86-
#[php_get_module]
87-
pub fn get_module() -> Module {
88-
let mut module = Module::new(
89-
env!("CARGO_PKG_NAME"),
90-
env!("CARGO_PKG_VERSION"),
91-
env!("CARGO_PKG_AUTHORS"),
92-
);
93-
94-
// ...
95-
96-
module
97-
}
98-
```
99-
100-
6. Build and install, if your php isn't installed globally, you should specify the path of `php-config`.
101-
102-
```bash
103-
# Optional, specify if php isn't installed globally.
104-
export PHP_CONFIG=<Your path of php-config>
105-
106-
# Build libmyapp.so.
107-
cargo build --release
108-
109-
# Install to php extension path.
110-
cargo run --release -- install
111-
# Or if you install php globally, you should use sudo.
112-
# sudo ./target/release/myapp install
113-
114-
```
115-
116-
7. Edit your `php.ini`, add the below line.
117-
118-
```ini
119-
extension = myapp
120-
```
121-
122-
8. Enjoy.
50+
```bash
51+
# If you are using debian like linux system:
52+
sudo apt install llvm-10-dev libclang-10-dev php-cli
53+
```
54+
55+
1. Create you cargo project, suppose your application is called myapp.
56+
57+
```bash
58+
cargo new myapp
59+
```
60+
61+
1. Add the dependencies and metadata to you Cargo project.
62+
63+
```toml
64+
[lib]
65+
crate-type = ["cdylib"]
66+
67+
[dependencies]
68+
phper = "<LATEST VERSION>"
69+
```
70+
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+
81+
1. Write you owned extension logic in `lib.rs`.
82+
83+
```rust
84+
use phper::{php_get_module, modules::Module};
85+
86+
#[php_get_module]
87+
pub fn get_module() -> Module {
88+
let mut module = Module::new(
89+
env!("CARGO_PKG_NAME"),
90+
env!("CARGO_PKG_VERSION"),
91+
env!("CARGO_PKG_AUTHORS"),
92+
);
93+
94+
// ...
95+
96+
module
97+
}
98+
```
99+
100+
1. Build and install, if your php isn't installed globally, you should specify the path of `php-config`.
101+
102+
```bash
103+
# Optional, specify if php isn't installed globally.
104+
# export PHP_CONFIG=<Your path of php-config>
105+
106+
# Build libmyapp.so.
107+
cargo build --release
108+
109+
# Install to php extension path.
110+
cargo run --release -- install
111+
# Or if you install php globally, you should use sudo.
112+
# sudo ./target/release/myapp install
113+
114+
```
115+
116+
1. Edit your `php.ini`, add the below line.
117+
118+
```ini
119+
extension = myapp
120+
```
121+
122+
1. Enjoy.
123123

124124
## Examples
125125

0 commit comments

Comments
 (0)