All Projects → iolevel → Wpdotnet Sdk

iolevel / Wpdotnet Sdk

Licence: other
WordPress compiled to .NET Standard. SDK for ASP.NET Core.

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Wpdotnet Sdk

Gonorth
GoNorth is a story and content planning tool for RPGs and other open world games.
Stars: ✭ 289 (-6.47%)
Mutual labels:  dotnet-core, dotnetcore
Anclafs
ASP.NET Core Library and Framework Support
Stars: ✭ 192 (-37.86%)
Mutual labels:  dotnet-core, dotnetcore
Angular 7 Project With Asp.net Core Apis
Angular 7 Project with ASP.NET CORE APIS | Angular Project
Stars: ✭ 174 (-43.69%)
Mutual labels:  dotnet-core, dotnetcore
Coreclr
CoreCLR is the runtime for .NET Core. It includes the garbage collector, JIT compiler, primitive data types and low-level classes.
Stars: ✭ 12,610 (+3980.91%)
Mutual labels:  dotnet-core, dotnetcore
Designpatterns
Simple repository containing one simple example for all existing patterns in C#
Stars: ✭ 231 (-25.24%)
Mutual labels:  dotnet-core, dotnetcore
Json Ld.net
A JSON-LD processor for .NET.
Stars: ✭ 171 (-44.66%)
Mutual labels:  dotnet-core, dotnetcore
Corehook
A library that simplifies intercepting application function calls using managed code and the .NET Core runtime
Stars: ✭ 191 (-38.19%)
Mutual labels:  dotnet-core, dotnetcore
Dotnet Etcd
A C# .NET (dotnet) GRPC client for etcd v3 +
Stars: ✭ 157 (-49.19%)
Mutual labels:  dotnet-core, dotnetcore
Jaya
Cross platform file manager application for Windows, Mac and Linux operating systems. (planned mobile support)
Stars: ✭ 219 (-29.13%)
Mutual labels:  dotnet-core, dotnetcore
Pixieditor
PixiEditor is a lightweight pixel art editor made with .NET 5
Stars: ✭ 210 (-32.04%)
Mutual labels:  dotnet-core, dotnetcore
Architecture
.NET 6, ASP.NET Core 6, Entity Framework Core 6, C# 10, Angular 13, Clean Code, SOLID, DDD.
Stars: ✭ 2,285 (+639.48%)
Mutual labels:  dotnet-core, dotnetcore
Peachpie Wordpress
WordPress running on .NET Core.
Stars: ✭ 237 (-23.3%)
Mutual labels:  wordpress, dotnetcore
Storedprocedureefcore
Entity Framework Core extension to execute stored procedures
Stars: ✭ 164 (-46.93%)
Mutual labels:  dotnet-core, dotnetcore
Rocksdb Sharp
.net bindings for the rocksdb by facebook
Stars: ✭ 173 (-44.01%)
Mutual labels:  dotnet-core, dotnetcore
Dotnet Retire
Open source vulnerability scanner for .NET Core projects
Stars: ✭ 161 (-47.9%)
Mutual labels:  dotnet-core, dotnetcore
Rafty
Implementation of RAFT consensus in .NET core
Stars: ✭ 182 (-41.1%)
Mutual labels:  dotnet-core, dotnetcore
Netbarcode
Barcode generation library written in C# and .NET Standard 2
Stars: ✭ 149 (-51.78%)
Mutual labels:  dotnet-core, dotnetcore
Appmetrics
App Metrics is an open-source and cross-platform .NET library used to record and report metrics within an application.
Stars: ✭ 1,986 (+542.72%)
Mutual labels:  dotnet-core, dotnetcore
Bridge
♠️ C# to JavaScript compiler. Write modern mobile and web apps in C#. Run anywhere with Bridge.NET.
Stars: ✭ 2,216 (+617.15%)
Mutual labels:  dotnet-core, dotnetcore
Sharpsnmplib
Sharp SNMP Library- Open Source SNMP for .NET and Mono
Stars: ✭ 247 (-20.06%)
Mutual labels:  dotnet-core, dotnetcore

All of WordPress as a .NET Standard assembly, without PHP.

.NET Core NuGet Downloads Stars

Chat with the community on Gitter if you need help:

How to add WordPress into your ASP.NET Core app

Use WordPress as ASP.NET Core Middleware.

  1. Add a package reference to Peachpied.WordPress.AspNetCore (Pre-Release)
  2. Add WordPress as middleware within your Configure startup method:
public class Startup
{
    public void Configure(IApplicationBuilder app)
    {
        // ...
        app.UseWordPress();
        // ...
    }
}

Configuration

appsettings.json

WordPress on .NET can be configured using the standard appsettings.json, you are no longer editing the wp-config.php source file.

{
  "WordPress": {
    "dbhost":        "localhost",
    "dbpassword":    "password",
    "dbuser":        "root",
    "dbname":        "wordpress",
    "dbTablePrefix": "wp_",
    "siteUrl":       "",
    "homeUrl":       "",
    "SALT": {
      "AUTH_KEY":         "r(EoMbKEvlg)",
      "AUTH_SALT":        "q0#AzvJ*[4~B",
      "LOGGED_IN_KEY":    "!AAienFSridC",
      "LOGGED_IN_SALT":   "C=(4(8WPMeRu",
      "NONCE_KEY":        "Z[[email protected]=y)m.C",
      "NONCE_SALT":       ";v7Wv/BV)Pz{",
      "SECURE_AUTH_KEY":  "pc}_Pv52,m=j",
      "SECURE_AUTH_SALT": "#n]+o^w/%-~M"
    },
    "constants": {
    }
  }
}

To generate your unique set of SALT, feel free to use Daniel Llewellyn's tool on https://wpdotnet-salts.azurewebsites.net/.

Note: WordPress expects the MySql database to be running, with the database dbname (wordpress by default) already created. Any of the configuration values can be omitted to use the default value.

ConfigureServices method

The service can be configured using AddWordPress configuration method. First argument is a callback providing options to be modified.

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddWordPress(options =>
        {
            options.DbHost = "localhost";
            options.DbName = "wordpress";
            // ...
        });
    }
}

The options object is already initialized with default values and with appsettings.json configuration.

Running this repo from the sources:

  1. Start mysql, at localhost:3306, user root, password password, created database wordpress
    • cmd: dotnet run -p app
    • vs: open solution and start app project
    • vscode: open folder and hit F5

WordPress on .NET SDK

The solution provides all of WordPress as a .NET standard assembly. Consisting of following projects:

  • app is a demo project that runs WordPress as a part of ASP.NET Core application.
  • PeachPied.WordPress contains the sources of WordPress that are compiled into a single .NET standard assembly (PeachPied.WordPress.dll). Together with its content files it is packed into a NuGet package PeachPied.WordPress. The project contains additional files:
    • wp-dummy.php declaring dummy classes required but not used by most plugins to be compiled successfully.
  • PeachPied.WordPress.DotNetBridge is a "must-use" plugin exposing the WordPress API to .NET.
  • PeachPied.WordPress.Standard defines an abstraction layer providing predefined PHP constants, and .NET interfaces that get implemented and called by the DotNetBridge plugin.
  • PeachPied.WordPress.AspNetCore is an ASP.NET Core request handler that configures the ASP.NET pipeline to pass requests to compiled WordPress scripts. The configuration includes response caching, short URL mapping, various .NET enhancements and the settings of the WordPress database.

This project contains the complete source code of WordPress with the additional "must use" WordPress plugin that exposes the PHP API to .NET. 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. Also this approach allows to take advantage of ASP.NET Core request handling and makes it possible to extend WordPress with C# (i.e. plugins, themes, etc.).

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. Utilize .NET with all its advantages like sourceless distribution or type safe and compiled code, which is further optimized and checked for the actual platform.
  • Integrate WP into a .NET application: drive the WordPress life cycle from a C# app, run within the Kestrel Web Server.
  • Sourceless distribution: after the compilation, most of the source files are not needed. Some files contain meta-data (like plugins and themes) and should be kept in the output.
  • Take advantage of the .NET runtime: JITted, secure and manageable platform.

Prerequisites

  • .NET Core 3.1 or newer
  • MySQL server
  • Optionally - Visual Studio 2017 or Visual Studio Code using the official Peachpie for VSCode extension available on the Marketplace
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].