Skip to content

Simple class witch handles compiling a .php script within C-Sharp

License

Notifications You must be signed in to change notification settings

Ni1kko/PHP-Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

PHP-Compiler

Simple class witch handles compiling a .php script within C-Sharp

Open Source? Yes! License: MIT

Setup


Copy php on build
Open Visual Studio And Create a folder inside root of you project named `php`
Now Download https://windows.php.net/downloads/releases/php-8.0.7-nts-Win32-vs16-x64.zip
With the Downloaded `php-8.0.7-nts-Win32-vs16-x64.zip` Extract all the archive contents into the folder named `php`
Now Open Visual Studio again and select all the files that you just moved inside the folder named `php`
With Selected click properties and change `Copy to Output Directory` too `Copy Always` 
Finaly With Selected change `Build Action` too `Embedded Resource`
Done.

Example-image

OR

Manualy add php
Create a folder beside you applicaions .exe named `php`
Now Download https://windows.php.net/downloads/releases/php-8.0.7-nts-Win32-vs16-x64.zip
With the Downloaded `php-8.0.7-nts-Win32-vs16-x64.zip` Extract all the archive contents into the folder named `php`
Done.

Example-image


Example Usage

using System;
using System.Threading.Tasks;
using Fallox;//add our namespace

namespace FalloxTest
{
    internal class Program
    {
        internal static async Task Main()
        {
            //How to get contents
            var filePath = @"c:\wwwroot\index.php";
            var page = await PHP.Compiler(filePath);

            //Show contents in console
            Console.WriteLine($"Page contents: {page}");
            Console.ReadKey();
        }
    }
}

About

Simple class witch handles compiling a .php script within C-Sharp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages