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
54
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
41
Go Reduce, reuse and recycle! PHP to GO!
crades
0
46
Static Code Analysis: Judging a Forest by Its Trees
crades
0
23
Other Decks in Technology
See All in Technology
ガバメントクラウド(AWS)へのデータ移行戦略の立て方【虎の巻】 / 20251011 Mitsutosi Matsuo
shift_evolve
PRO
2
190
BI ツールはもういらない?Amazon RedShift & MCP Server で試みる新しいデータ分析アプローチ
cdataj
0
100
能登半島地震で見えた災害対応の課題と組織変革の重要性
ditccsugii
0
540
『OCI で学ぶクラウドネイティブ 実践 × 理論ガイド』 書籍概要
oracle4engineer
PRO
3
200
ガバメントクラウドの概要と自治体事例(名古屋市)
techniczna
2
230
CoRL 2025 Survey
harukiabe
0
140
Git in Team
kawaguti
PRO
3
350
リーダーになったら未来を語れるようになろう/Speak the Future
sanogemaru
0
380
10年の共創が示す、これからの開発者と企業の関係 ~ Crossroad
soracom
PRO
1
720
実装で解き明かす並行処理の歴史
zozotech
PRO
1
710
「れきちず」のこれまでとこれから - 誰にでもわかりやすい歴史地図を目指して / FOSS4G 2025 Japan
hjmkth
1
290
SwiftUIのGeometryReaderとScrollViewを基礎から応用まで学び直す:設計と活用事例
fumiyasac0921
0
160
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
185
22k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
A designer walks into a library…
pauljervisheath
209
24k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Why Our Code Smells
bkeepers
PRO
339
57k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Speed Design
sergeychernyshev
32
1.2k
Reflections from 52 weeks, 52 projects
jeffersonlam
352
21k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
54
3k
Agile that works and the tools we love
rasmusluckow
331
21k
Facilitating Awesome Meetings
lara
56
6.6k
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/