The library support for running PHP scripts on the client side by Blazor and PeachPie
Перейти к файлу
Tomas Husak ba25baba89 Update appsettings.json 2021-08-07 17:27:48 +02:00
.github/workflows Create dotnet.yml 2021-07-17 15:19:20 +02:00
build/StrongKeys
docs Link wwwroot 2021-08-07 17:25:11 +02:00
src Update appsettings.json 2021-08-07 17:27:48 +02:00
.gitignore
Directory.Build.props Add author information 2021-08-06 19:58:20 +02:00
LICENSE.txt Create LICENSE.txt 2021-07-17 17:58:41 +02:00
README.md Update README.md 2021-07-27 23:01:20 +02:00
global.json uses peachpie v1.0.6 2021-07-17 15:04:39 +02:00
peachpie-blazor.sln Add Solution Items to .sln 2021-08-06 20:06:45 +02:00

README.md

PHP Tools for Blazor

PHP as a client side language

What is it?

This repository contains Peachpie.Blazor library and Peachpie.Blazor.Sdk to enable making websites with PHP together with Blazor on a client side. With these components, you can write just PHP scripts, which are transparently navigated and managed.

You can see the usage demonstration below.

Demo

Why is it useful?

There are potential scenarios of usage:

  • You want to move a PHP website to a client side to save server resources.
  • You have a Blazor website and want to write a part of the website in the PHP language.
  • You want to use PHP libraries on the client side.
  • PHP and Blazor team can work together to make an awesome website using .NET and PHP.

How to get started?

You can start right now.

Steps:

  1. Install Peachpie.Templates by dotnet new -i "Peachpie.Templates::*"
  2. Choose the template based on your intention:
    • blazor-hybrid- A simple PHP website running in browser
    • blazor-web - A simple Blazor website combining PHP and Razor Pages
  3. Create the project by dotnet new project-name
  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
Solution structure

Features

  • Transparent navigation of PHP scripts by URL

  • Transparent rendering of HTML pages generated from PHP

  • Full support of \_GET, _POST, and $_FILES

  • Simulation of a server on a client side

  • Forms are handled by PHP on a client side

  • Possibility of persistent PHP context to save client session on a client side

  • Inserting PHP scripts to Razor pages

  • PHP, C#, JavaScript interoperability

Future plans

There is a rough overview of the possible plans for the future:

  • Make rendering with the PhpScriptProvider efficient enough in order to remove PhpComponent and make the usage even more transparent.
  • Figure out the support for databases.
  • Move WordPress to a client side.

Documentation

Detailed information about the solution, the library, and the functionality can be found in docs folders. Advanced features of the integration are shown there. There can be some missing information about any part of the whole project. If you can ask about something, feel free to contact me, and I will add this information to the folder for future interested people.

Release

This is the first version of the integration. The API and functionality might still change to improve the advantages. The sources compilation should work, feel free to contact me (husaktomas98@gmail.com) to get more information about this project.