Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Writing PHP extensions in Rust
Search
Christian Rades
November 18, 2022
Technology
0
52
Writing PHP extensions in Rust
Christian Rades
November 18, 2022
Tweet
Share
More Decks by Christian Rades
See All by Christian Rades
Your first PHP extension
crades
0
40
Go Reduce, reuse and recycle! PHP to GO!
crades
0
44
Static Code Analysis: Judging a Forest by Its Trees
crades
0
22
Other Decks in Technology
See All in Technology
開発者を支える Internal Developer Portal のイマとコレカラ / To-day and To-morrow of Internal Developer Portals: Supporting Developers
aoto
PRO
1
370
Snowflakeの生成AI機能を活用したデータ分析アプリの作成 〜Cortex AnalystとCortex Searchの活用とStreamlitアプリでの利用〜
nayuts
0
310
おやつは300円まで!の最適化を模索してみた
techtekt
PRO
0
280
テストを軸にした生き残り術
kworkdev
PRO
0
180
ヘブンバーンズレッドにおける、世界観を活かしたミニゲーム企画の作り方
gree_tech
PRO
0
570
フィンテック養成勉強会#56
finengine
0
130
異業種出身エンジニアが気づいた、転向して十数年経っても変わらない自分の武器とは
macnekoayu
0
300
AI時代にPdMとPMMはどう連携すべきか / PdM–PMM-collaboration-in-AI-era
rakus_dev
0
280
AI開発ツールCreateがAnythingになったよ
tendasato
0
110
Bye-Bye Query Spaghetti: Write Queries You'll Actually Understand Using Pipelined SQL Syntax
tobiaslampertlotum
0
140
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
30k
Obsidian応用活用術
onikun94
1
400
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Site-Speed That Sticks
csswizardry
10
810
Producing Creativity
orderedlist
PRO
347
40k
A designer walks into a library…
pauljervisheath
207
24k
Optimizing for Happiness
mojombo
379
70k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.6k
Become a Pro
speakerdeck
PRO
29
5.5k
KATA
mclloyd
32
14k
Writing Fast Ruby
sferik
628
62k
Documentation Writing (for coders)
carmenintech
74
5k
How to Think Like a Performance Engineer
csswizardry
26
1.9k
Visualization
eitanlees
148
16k
Transcript
Twig as an Extension An Experiment powered by Rust
Hi everyone! My name Christian principal engineer at shopware @C_Rades
@
[email protected]
Titel hinzufügen
Why ? Reduce the reliance on opcache Maybe improve the
speed of rendering Have fun and learn about interpreters
How to ? The basics
Greeting
Hello World
Function calls
Calling a PHP function
Calling a function from rust
Method calls
Calling a php method
Calling a php method 2
Calling a method from rust
Calling a method from rust
Rust lifetimes are hard*
Escape hatches
Clone() • References need to ful fi l lifetimes •
So just use “owned” types • Comes in many fl avours • &str -> String • &Foo -> Foo
Zval::shallow_clone() • A little different for PHP values • It
copies the Zval without duplicating its content • &Zval -> Zval
A php obj as parameter
Thank you • The repo: https://github.com/Christian-Rades/Tape • The rust crate:
https://davidcole1340.github.io/ext-php-rs/introduction.html • Learning rust: https://doc.rust-lang.org/book/ • Learning Lifetimes: https://rust-unof fi cial.github.io/too-many-lists/