Introducing: apps.peachpie.io

Since we are seeing the same issues with our users and clients over and over, we decided to create a service that would solve them for us. After months of fine-tuning the technical implementation of this solution, we are happy to introduce apps.peachpie.io.

The problem

The PHP ecosystem is incredibly diverse and inter-connected. We noticed that many of our clients essentially use somewhat similar components, libraries, and frameworks within their applications and we started to look for a way to automate some of our work for our clients. Like most other major programming languages, PHP has its own package management and distribution platform – the composer packages hosted on packagist.org. Similarly to .NET’s NuGets, PHP applications essentially cross-reference these packages, which they require to be downloaded.

When migrating large PHP apps to .NET, we had to start from the ground up. First, we collect and check all the required packages, see if the packages compile, analyze build-time diagnostics, integrate the PHP application into an ASP.NET Core application, and then run the program to test it all together. Clients also repeatedly request the continuous replacement of old PHP code fragments with shorter and safer C# equivalent.

The solution – PeachPie Apps

In order to make our lives easier, we started creating NuGets out of PHP’s building blocks – the packages – so that we could simply reference them in a .NET project. Eventually, we got to thinking that the whole community could benefit from having a set of ready-to-be used compiled PHP components that are tried and tested. And so apps.peachpie.io was born.

Our approach to the problem was to create a catalog of already compiled, verified and ready-to-use components migrated from the PHP world to run natively on .NET as securely signed and source-less NuGet packages, provided in an industry-standard way. The packages are hosted on our own NuGet V3 feed, and we’ll get to the reasons why a little later.

All the packages you can find on apps.peachpie.io are regular NuGets that can be referenced from any .NET Standard project just like any other library you could find on NuGet.org. The packages respect .NET conventions and versioning, with specified dependencies, not requiring any additional component to be installed. Let’s get into what exactly you can do and how.

How to work with apps.peachpie.io

First and foremost, you’ll notice two tabs at the very top of the page: .NET and WordPress (.NET). Let’s start with the former. The main page of apps.peachpie.io shows various libraries we’ve already published on the site – some bigger and some smaller. Let’s take a look at how to make things work with a smaller one: ASCIIMath2TeX.Net.

Begin by signing in using a GitHub account. Each package has its dedicated page containing all kinds of information, including a neat overview, usually with code samples. For the step-by-step instructions on how to add the package into your .NET project, click “Connect to feed“:

The package summary, and the “Connect to feed” button.

You’ll notice we have provided steps for four different environments depending on your preferred choice: the command line (CLI) and different IDEs (Visual Studio, VS Code, or Rider). The packages are hosted on the NuGet feed with the following Source URL:

https://feed.peachpie.io/public/v3/index.json

CLI

On the command line, first add the package source. The following command installs the global package source allowing all your .NET projects to consume the packages:

dotnet nuget add source https://feed.peachpie.io/public/v3/index.json -n peachpie.io(public)

Add the package, ASCIIMath2TeX.Net for example, into your project with the command:

dotnet add package ASCIIMath2TeX.Net --version 1.0.20200319-*

IDE

Using the packages in an integrated development environment will of course depend on the individual platform.

In Visual Studio, you’ll add our feed as a new package source under Tools | Options , under the section NuGet Package Manager | Package Sources. Click the [+] button and enter our package source URL: https://feed.peachpie.io/public/v3/index.json

Package Sources Options in Visual Studio
Package Sources in Visual Studio

Then go to your project NuGet package manager (in Project | Manage NuGet Packages), and search and install the package:

NuGet Package Manager.

The same goes for Rider, where you’ll find the option under Tools | NuGet | Manage NuGet Packages for Solution, then switch to the Sources tab and hit the [+] button to add our package source URL:

Command to manage NuGet packages in Rider
NuGet package sources in RiderNuGet sources feeds in Rider

Finally, if you prefer to configure your NuGet sources manually within NuGet.config file, it would look like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <packageSources>
  <add key="peachpie.io(public)" value="https://feed.peachpie.io/public/v3/index.json" />
 </packageSources>
</configuration>

And that’s it. Now you’re ready to use the stand-alone ASCIIMath2TeX package in your .NET project, originally developed at github.com/asciimath/asciimathml. The fact that it once used to be PHP code is completely irrelevant to your application. It simply sees the component as yet another NuGet package and there are absolutely no PHP sources when you reference this compiled library. Following the attached code sample, you can now translate an ASCII math formula into TeX format:

var am2t = new AMtoTeX();
Console.Write(am2t.convert("3^f-4").ToString());

But what about larger apps? If you go back to the homepage, you’ll notice our catalog already includes some fairly large applications, such as WordPress or Twig, PHP’s popular templating engine. The wonderful thing about apps.peachpie.io is that the process works the same way, even if you’re working with an extremely large library or application. But when it comes to WordPress, there’s even more.

WordPress on .NET

While the main catalog of .NET apps does indeed include WordPress for ASP.NET Core (aka WpDotNet), which installs the core WordPress application, there’s a whole entire second tab on our apps.peachpie.io page – WordPress (.NET). This page actually lists another NuGet source feed providing thousands of plugins and themes already compiled as NuGet packages. The source feed URL is:

https://feed.peachpie.io/wpdotnet/v3/index.json

In order to make use of them, you’ll first have to add the core WpDotNet into your ASP.NET Core application by adding the package reference:

dotnet add package PeachPied.WordPress.AspNetCore --version 5.5.1-preview2

Then add the WordPress middleware within your ASP.NET Core request pipeline within the Configure startup method:

class Startup {
    public void Configure(IApplicationBuilder app) {
        // ...
        app.UseWordPress();
        // ...
    }
}

Now you’re ready to add one of the hundreds of plugins we already compiled for you from our catalog. You can do this either from the WordPress dashboard itself (after you run and deploy the application) or already at design time! This means you can specify plugins and themes right in your ASP.NET Core project as another Package Reference. Add the NuGet source feed either in your IDE or on the command line:

dotnet nuget add source https://feed.peachpie.io/wpdotnet/v3/index.json -n peachpie.io(wpdotnet)

And add the package reference to the plugin you want, either on the command line, or using the NuGet Manager right in Visual Studio:

NuGet Manager listing WpDotNet plugins and themes.

We will continuously increase the selection of available themes and plugins and update the existing ones as well. As you can see, any package overview page includes all the same information you can find on the WordPress marketplace, including the changelog, original authors, copyrights, etc.

If you need more information on how to get WpDotNet to run, please refer to our documentation.

Future development

What we published today is merely the preview of what we hope to become an extensive catalog of amazing components and applications that will be seamlessly available to the .NET world. We will of course keep adding and updating WordPress plugins and themes, but we’ll also add further .NET components. You’ll likely see entire large frameworks, e.g. Laravel, or applications, e.g. Drupal, appearing on apps.peachpie.io.

More importantly, however, our plan is to allow developers to publish their own apps and distribute them through our site. In the PHP world, selling your application isn’t always that easy, as you are also giving away your source code. This isn’t our case, since we distribute the programs as source-less NuGet packages. What’s more significant, however, is that a PHP developer can target a completely new audience with their apps through our feed.

Please do give apps.peachpie.io a try and let us know what you think of it or if anything is unclear. We appreciate any constructive feedback!

Posted on October 8, 2020, in category Announcement, News, tags: , , , , , , , ,