drupalonwindows / netphp
Installs: 16 686
Dependents: 0
Suggesters: 0
Security: 0
Stars: 31
Watchers: 9
Forks: 6
Open Issues: 2
Requires
- php: >=5.5.0
Requires (Dev)
- phpunit/phpunit: 5.0.*
README
Using .Net code from PHP needs not to be a nightmare any more! Built upon the com_dotnet extension this library allows you to easily integrate your .Net code into any PHP application.
- Use any .Net binaries (even without COM Visibility).
- Write code in PHP that consumes any of the .Net Framework libraries out of the box.
- Automatically generated PHP class dumps for IDE integration.
- Iterate over .Net collections directly from PHP.
- Propagation of .Net errors into native PHP exceptions that can be properly handled and examined.
- Acces native enums and static methods.
- Use class constructors with parameters.
- Debug .Net and PHP code at the same time as if it was a single application.
- Works with libraries compiled for any version of the .Net framework (including 4.0 and above)
See it in action
Download the examples project from GitHub
[Check out the NetPhp User Guide] (http://www.drupalonwindows.com/en/blog/netphp-user-guide)
This code in C#:
string javascript = ""; Microsoft.Ajax.Utilities.Minifier m = new Microsoft.Ajax.Utilities.Minifier(); Microsoft.Ajax.Utilities.CodeSettings settings = new Microsoft.Ajax.Utilities.CodeSettings(); settings.OutputMode = Microsoft.Ajax.Utilities.OutputMode.SingleLine; settings.PreserveFunctionNames = false; string minified = m.MinifyJavaScript(javascript, settings);
Can be writen like this in PHP:
$minifier = netMinifier::Minifier_Constructor(); $settings = netCodeSettings::CodeSettings_Constructor(); $csssettings = \ms\Microsoft\Ajax\Utilities\netCssSettings::CssSettings_Constructor(); $settings->OutputMode(\ms\Microsoft\Ajax\Utilities\netOutputMode::SingleLine()); $settings->PreserveFunctionNames(FALSE); $settings->QuoteObjectLiteralProperties(TRUE); $result = $minifier->MinifyStyleSheet($css, $csssettings, $settings)->Val();