Overview#
Integration of Blazor and PeachPie enables executing PHP scripts on a client side without additional requests to a server. The integration comprises Peachpie.Blazor
and Peachpie.Blazor.Sdk
providing helper structures to make PHP a valuable part of client side web development. Everything is built on top of the Blazor platform, so you don't need any browser extensions.
Requirements#
.NET 5 SDK (Download .NET 5.0 (Linux, macOS, and Windows) (microsoft.com))
Quick Start#
- Install Peachpie.Templates by
dotnet new -i "Peachpie.Templates::*"
- Choose the template based on your intention:
- phpwasm - A simple PHP website running in browser
- blazorwasm - A simple Blazor website combining PHP and Razor Pages
- Create the project by
dotnet new [project-name] -lang PHP
- Add Razor pages to BlazorApp.Client or PHP scripts to PHPScripts (Optional)
- Launch the Blazor.Server by
dotnet run --project BlazorApp\Server
- Access https://localhost:5001
Demo#
Demo examples can be found in src/Tests/Examples folder of the official repository peachpiecompiler/peachpie-blazor.
You can see a simple PHP web application, which is created as a Peachpie project and downloaded to a client by only one initial request below. The next navigation in the website is offline, using the Blazor environment.
Remarks#
- The integration provides a lot of advanced features like JS PHP interoperability or transparent evaluating of web forms without request to a server.
- There are many user scenarios, which are interesting and can be found in the examples.
- See also other documentation files describing all features of the library.