The library support for running PHP scripts on the client side by Blazor and PeachPie
Перейти к файлу
Tomas Husak 44ff88dae6
Fix Readme
2021-07-15 18:01:10 +02:00
build/StrongKeys Change repository structure 2021-07-14 11:22:03 +02:00
docs Create README.md 2021-07-15 17:54:55 +02:00
src Document IPHPService.cs, PHPModule.cs, and PHPService.cs methods 2021-07-15 15:32:47 +02:00
templates Fix templates 2021-07-14 16:29:29 +02:00
.gitignore Change repository structure 2021-07-14 11:22:03 +02:00
Directory.Build.props Supress xml warnings 2021-07-15 14:59:01 +02:00
README.md Fix Readme 2021-07-15 18:01:10 +02:00
global.json Change repository structure 2021-07-14 11:22:03 +02:00
peachpie-blazor.sln Change repository structure 2021-07-14 11:22:03 +02:00

README.md

Blazor plus Peachpie

PHP as a client side language

The library and SDK aren't presented on nuget.org yet. But if you want to already try it, just compile the Peachpie.Blazor.Sdk and Peachpie.Blazor and add the nuget paths to NuGet.Config file.

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 script, which are transparently navigated and managed.

You can see usage demonstration bellow.

Demo

Why it is useful ?

There are potential scenarios of usage:

  • You want to move a PHP website to a client side for saving 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 a client side.
  • PHP and Blazor team can work together to make awesome website using .NET and PHP.

How to get started ?

You can start right now.

Steps:

  1. Install .NET 5.0 SDK

  2. Install Peachpie.Blazor.Templates by dotnet new -i "Peachpie.Blazor.Templates::*"

  3. Choose a template depending on your intention:

    • Peachpie Blazor Web - A simple PHP website running in browser

    • Peachpie Blazor Hybrid - A simple Blazor website combining PHP and Razor Pages

  4. Create the project by dotnet new project-name

  5. Add Razor pages to BlazorApp.Client or PHP scripts to PHPScripts (Optional)

  6. Launch the Blazor.Server by navigating to its folder and run dotnet run

  7. 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 enough efficient 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 these information to the folder for future interested people.

Release

This is a 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@google.com) to get more information about this project.