peachpie-blazor/docs/overview.md

2.2 KiB

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

  1. Install Peachpie.Templates by dotnet new -i "Peachpie.Templates::*"
  2. 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
  3. Create the project by dotnet new [project-name] -lang PHP
  4. Add Razor pages to BlazorApp.Client or PHP scripts to PHPScripts (Optional)
  5. Launch the Blazor.Server by dotnet run --project BlazorApp\Server
  6. 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.

Demo

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.