Code Monkey home page Code Monkey logo

peachpie-wordpress's Introduction

WordPress Sample

The goal of this sample is to fully compile an unmodified clone of WordPress into .NET/.NET Core. The project consists of several parts:

  • website contains sources of WordPress that are compiled into a single .NET Core assembly (website.dll) and WordPress content files that will be served by web server.
  • app project is executable sample ASP.NET Core web server bootstrapping scripts from website.

What does this do?

This sample contains the complete source code of WordPress with none or little modifications. The purpose is for this code to be compiled by Peachpie, resulting in the output running purely on Microsoft .NET Core.

Therefore, if everything works as it should, you will see the standard unchanged WordPress in the same way as you would in the traditional PHP version. The difference is that the compiled website runs on .NET Core in the background.

How does this work?

The PHP sources in website are compiled to .NET Core by Peachpie compiler, which is seamlessly downloaded by dotnet itself.

The sample instantiates Kestrel - the opensource web server - and the ASP.NET Core pipeline. The pipeline handles requests to PHP files using the Peachpie RequestDelegate by calling the corresponding compiled scripts in website.dll.

Note that the original PHP sources (*.php files) in website are not needed to run the compiled application, however, WordPress accesses some files using file-system functions and requires them there.

Possible Use Cases

  • Improve performance: compiled code is fast and also optimized by the .NET 'Jitter' for your actual system. Additionally, the .NET performance profiler may be used to resolve bottlenecks.
  • Write plugins in C#: plugin functionality can be implemented in a separate C# project and/or PHP plugins may use .NET libraries.
  • Integrate WP into a .NET application: drive the WordPress lifecycle from a C# app, run within the Kestrel Web Server.
  • 'Almost' sourceless distribution: after the compilation, most of the source files are not needed.
  • Take advantage of the .NET runtime: jittered, secure and manageable platform.

Prerequisites

  • .NET Core 1.1 or newer
  • MySQL server running on a preconfigured port (3306)
  • Optionally - Visual Studio 2017 or Visual Studio Code using the official Peachpie for VSCode extension available on the Marketplace

How to run the project

  1. start mysql, at localhost:3306, user root, password password
  2. dotnet restore
  3. cd app
  4. dotnet run

peachpie-wordpress's People

Contributors

bfistein avatar jakubmisek avatar linezero avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

ikvm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.