oxidize-for-laravel maintained by jakub-lipinski
About Oxidize
Oxidize connects an existing PHP Laravel application to a Laravel for Rust app on the same domain. Send a route such as /search to Rust while PHP continues to serve the rest of the site. Customers keep their login and cart as they move between the two apps.
- Read PHP sessions. Use database, Redis, file, or cookie sessions, in PHP serialization or JSON. Rust reads them by default and changes them only when you opt in.
- Reuse authentication and CSRF. Resolve the same customer in Rust and verify form tokens issued by PHP.
- Send jobs both ways. Move messages between PHP and Rust over a database or Redis. Existing PHP workers can handle jobs sent from Rust.
- Work with the existing schema. Generate Rust models from the database, check them for drift in CI, and use
oxidize:doctorto check the bridge configuration.
Quick start
Docker Compose runs the PHP and Rust apps with MySQL, Redis, Mailpit, and Caddy.
git clone https://github.com/jakub-lipinski/oxidize-for-laravel.git
cd oxidize-for-laravel/examples
docker compose up
Open the shop on localhost:8080. Sign in as buyer@example.com with oxidize-demo, add a product to your cart, and search for Bolt. Rust reads the cart from PHP and applies the customer's trade discount. Pick Ask for a quote to send a job back to PHP, then open Mailpit on localhost:8025 to see the email.
If port 8080 is busy, start with SHOP_PORT=18082 docker compose up. See the demo guide for routes and configuration.
Search benchmark
Both endpoints returned the same 24 results from a 50,000-product MySQL catalog. The measurements include Caddy, middleware, the database query, and JSON encoding in the demo stack. Full results, hardware, and reproduction steps
Tests
cargo nextest run --workspace
composer install
composer test
The workspace passed 76 Rust tests. The PHP package passed 13 tests per combination across PHP 8.3 and 8.4 with Laravel 11, 12, and 13. Service-backed tests cover shared sessions and both queue directions, and CI checks the generated demo models against MySQL. Keep Redis running when running the PHP tests locally. Wire-format coverage · CI workflow
Compatibility and docs
| Supported in 0.1.0 | |
|---|---|
| PHP application | Laravel 11–13, with each version's PHP requirements |
| Rust application | Rust 1.99+ and Laravel for Rust 0.1.x |
| Database models | SQLite, MySQL/MariaDB, and PostgreSQL |
| License | MIT |
PHP owns the shared schema. Run Rust migrations on a separate database or schema. Session writes are opt-in. A session store outage gives a guest session by default and can be configured to return HTTP 503.
Routing recipes · Security and vulnerability reporting · Releases
Oxidize is an independent open-source project released under the MIT license.