All Projects → jmjoy → phper

jmjoy / phper

Licence: Unlicense License
A library that allows us to write PHP extensions using pure Rust and using safe Rust whenever possible.

Programming Languages

rust
11053 projects
c
50402 projects - #5 most used programming language
PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to phper

millennials-to-snake-people
🐍 Chrome extension that replaces occurrences of 'Millennials' with 'Snake People'
Stars: ✭ 187 (+679.17%)
Mutual labels:  extension
eshteb
Reduces the anger of an Iranian when typing in the wrong language!
Stars: ✭ 42 (+75%)
Mutual labels:  extension
croatoan
Common Lisp bindings for the ncurses terminal library.
Stars: ✭ 111 (+362.5%)
Mutual labels:  binding
hstore-extension
The encoder/decoder and set of the doctrine functions for the postgresql type `hstore`
Stars: ✭ 14 (-41.67%)
Mutual labels:  extension
core
🔥 Antares Core Implemenation. Most important project layer, this is the heart for your app. ACL, notifiter, console, geoip, areas, utils and many more...
Stars: ✭ 24 (+0%)
Mutual labels:  extension
yithemes
Atom One Dark & One Light themes ported for VS Code.
Stars: ✭ 12 (-50%)
Mutual labels:  extension
blur-my-shell
Extension that adds a blur look to different parts of the GNOME Shell, including the top panel, dash and overview
Stars: ✭ 516 (+2050%)
Mutual labels:  extension
Linkaro
A browser extension to easily store your social links and share them from right within your browser.
Stars: ✭ 31 (+29.17%)
Mutual labels:  extension
raylib-nelua
Raylib wrapper to nelua language
Stars: ✭ 27 (+12.5%)
Mutual labels:  binding
wasm-extension-template
An easy-to-use template for Rust web extensions. The Rust code is compiled to WASM and ran as a content script.
Stars: ✭ 78 (+225%)
Mutual labels:  extension
vsc
☢️ A fresh-looking, neon theme for Visual Studio Code Almost radioactive.
Stars: ✭ 24 (+0%)
Mutual labels:  extension
pass-fzf
Fuzzy finder for pass
Stars: ✭ 20 (-16.67%)
Mutual labels:  extension
PlayniteVndb
Enables VNDB as a Metadata source for Playnite
Stars: ✭ 47 (+95.83%)
Mutual labels:  extension
nekocap
Browser extension for creating & uploading community captions for YouTube, niconico and other video sharing sites.
Stars: ✭ 27 (+12.5%)
Mutual labels:  extension
mw-discord
📝 MediaWiki extension that sends notifications to Discord, used on https://runescape.wiki.
Stars: ✭ 16 (-33.33%)
Mutual labels:  extension
emscripten-sys
Emscripten API bindings for Rust
Stars: ✭ 18 (-25%)
Mutual labels:  binding
testup-2
TestUp 2 for SketchUp - A GUI wrapper for running Minitest in SketchUp
Stars: ✭ 21 (-12.5%)
Mutual labels:  extension
vscode-gitignore
A simple extension for Visual Studio Code that lets you pull .gitignore files from the https://github.com/github/gitignore repository
Stars: ✭ 44 (+83.33%)
Mutual labels:  extension
AndroidSDKSearchExtension-Firefox
A Firefox port of the Chrome extension that adds an 'ad' Awesome Bar command and view source links for the Android SDK.
Stars: ✭ 19 (-20.83%)
Mutual labels:  extension
cake-vso
Cake integration for Azure DevOps.
Stars: ✭ 19 (-20.83%)
Mutual labels:  extension

PHPer

CI Crates Docs Lines License

Rust ❤️ PHP

A library that allows us to write PHP extensions using pure Rust and using safe Rust whenever possible.

Requirement

Necessary

  • rust 1.56 or later
  • libclang 9.0 or later
  • php 7.0 or later

Tested Support

  • OS
    • linux
    • macos
    • windows
  • PHP
    • version
      • 7.0
      • 7.1
      • 7.2
      • 7.3
      • 7.4
      • 8.0
      • 8.1
    • mode
      • nts
      • zts
    • sapi
      • cli
      • fpm
    • debug
      • disable
      • enable

Usage

  1. Make sure libclang and php is installed.
# If you are using debian like linux system:
sudo apt install llvm-10-dev libclang-10-dev php-cli
  1. Create you cargo project, suppose your application is called myapp.
cargo new myapp
  1. Add the dependencies and metadata to you Cargo project.
[lib]
crate-type = ["cdylib"]

[dependencies]
phper = "0.3"
  1. Add these code to main.rs.
use phper::cmd::make;

fn main() {
    make();
}
  1. Write you owned extension logic in lib.rs.
use phper::{php_get_module, modules::Module};

#[php_get_module]
pub fn get_module() -> Module {
    let mut module = Module::new(
        env!("CARGO_PKG_NAME"),
        env!("CARGO_PKG_VERSION"),
        env!("CARGO_PKG_AUTHORS"),
    );

    // ...

    module
}
  1. Build and install, if your php isn't installed globally, you should specify the path of php-config.
# Optional, specify if php isn't installed globally.
export PHP_CONFIG=<Your path of php-config>

# Build libmyapp.so.
cargo build --release

# Install to php extension path.
cargo run --release -- install
# Or if you install php globally, you should use sudo.
# sudo ./target/release/myapp install
  1. Edit your php.ini, add the below line.
extension = myapp
  1. Enjoy.

Examples

See examples.

License

Unlicense.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].