Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

boang3000's avatar

Laravel using dotnet class

Hi, as the title says. I need to use the dotnet class. Currently, I've got an existing .NET application, not created by me, which works fine. But I have to communicate it via Laravel.

There was an existing site but have to convert it to Laravel since the old one is kind of outdated and running some problems and is made in typescript or node.

Currently using the latest Laravel version. Using this line of code will return an error dotnet class not found.

$buildWallTypeEventHandler = new dotnet("Metsec.ProductSelector.Addin", "Metsec.ProductSelector.Addin.BuildWallTypeEventHandler");

I have installed the php_com_dotnet.dll in my system and enabled it which shows on phpinfo() that it is already enabled.

Found another link (drupalonwindows.com/en/blog/calling-net-framework-and-net-assemblies-php) which I've tried following the instructions and works fine until I ran the code:

$buildWallTypeEventHandler = new \NetPhp\Core\NetPhpRuntime("COM", "Metsec.ProductSelector.Addin.BuildWallTypeEventHandler");
dd($buildWallTypeEventHandler->Initialize());

Dumping the initialize returns an error "Could not instantiate COM class. Invalid syntax might meen that the COM component is simply not registered."

Let me know if there is something that I missed. Thanks!

0 likes
0 replies

Please or to participate in this conversation.