<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Steven Rojas</title>
    <description>The latest articles on DEV Community by Steven Rojas (@steven_rojas_8da8fd7f93d7).</description>
    <link>https://dev.to/steven_rojas_8da8fd7f93d7</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4125179%2F55ff350c-f45f-4472-91d0-542629b19abf.png</url>
      <title>DEV Community: Steven Rojas</title>
      <link>https://dev.to/steven_rojas_8da8fd7f93d7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/steven_rojas_8da8fd7f93d7"/>
    <language>en</language>
    <item>
      <title>How I embedded PHP 8.4 runtime directly into Android &amp; iOS apps</title>
      <dc:creator>Steven Rojas</dc:creator>
      <pubDate>Mon, 14 Sep 2026 22:23:40 +0000</pubDate>
      <link>https://dev.to/steven_rojas_8da8fd7f93d7/how-i-embedded-php-84-runtime-directly-into-android-ios-apps-c37</link>
      <guid>https://dev.to/steven_rojas_8da8fd7f93d7/how-i-embedded-php-84-runtime-directly-into-android-ios-apps-c37</guid>
      <description>&lt;p&gt;For years, mobile development meant one of two extremes: either go full native (Kotlin/Swift) or pick a heavy JS framework (React Native, Flutter, Cordova/Capacitor) where your mobile app acts as a dumb API client fetching data from a remote server.&lt;/p&gt;

&lt;p&gt;As a PHP developer, I kept asking myself: &lt;strong&gt;Why can't we execute real PHP business logic locally on the phone processor?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  That's why I built &lt;strong&gt;Phphone&lt;/strong&gt; (&lt;a href="https://phphone.xyz" rel="noopener noreferrer"&gt;https://phphone.xyz&lt;/a&gt;) — an open-source compiler and runtime that packages an embedded PHP 8.4 engine directly into native Android and iOS mobile binaries.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🏗️ The Architecture: Display vs. Embedded Engine
&lt;/h2&gt;

&lt;p&gt;In Phphone, the WebView is &lt;strong&gt;only the display layer&lt;/strong&gt;. &lt;br&gt;
Unlike typical web wrappers where heavy JS frameworks bog down client performance, Phphone delegates business logic to the phone's CPU via embedded PHP 8.4:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Android:&lt;/strong&gt; Runs a lightweight PHP 8.4 engine in native C++ via JNI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;iOS:&lt;/strong&gt; Executes PHP natively through Swift bridge integrations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database:&lt;/strong&gt; Integrated local SQLite3 for instant, offline relational persistence without network latency.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Phphone\Device&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Native hardware access directly from PHP:&lt;/span&gt;
&lt;span class="nc"&gt;Device&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Offline Alert"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Task saved to local SQLite!"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nc"&gt;Device&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;vibrate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$coords&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Device&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;gps&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔐 Built-in IP Protection: In-Memory AES-256&lt;br&gt;
One of the biggest concerns developers have about shipping PHP on client devices is intellectual property.&lt;/p&gt;

&lt;p&gt;To solve this, release builds (phphone build apk --release) cryptographically shield source files with AES-256-CBC. During runtime, controllers and business logic are decrypted symmetrically directly in RAM inside the native chassis (Kotlin/Swift). The PHP source is never exposed in plaintext inside the APK/IPA bundle.&lt;/p&gt;

&lt;p&gt;🚀 Try it out&lt;br&gt;
Phphone is free and open-source under Apache-2.0. We just tagged v1.0.2 with full iOS App and Android App Store compliance.&lt;/p&gt;

&lt;p&gt;Website &amp;amp; Docs: &lt;a href="https://phphone.xyz" rel="noopener noreferrer"&gt;https://phphone.xyz&lt;/a&gt;&lt;br&gt;
GitHub Repository: &lt;a href="https://github.com/phphone/phphone" rel="noopener noreferrer"&gt;https://github.com/phphone/phphone&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’d love to hear your thoughts, architectural critique, and answer any questions from the community!&lt;/p&gt;

</description>
      <category>php</category>
      <category>ios</category>
      <category>android</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
