NetPhp: using .Net from PHP is not a nightmare anymore.
The NetPhp is a set of libraries that allow you to seamlessly operate on .Net types from PHP:
- Use any .Net binaries (even without COM Visibility) and ANY version of the .Net framework including CLR4
- Iterate over .Net collections directly from PHP
- PHP class model generation, to use PHP classes as if it where .Net
- Automatic propagation of .Net errors into native PHP exceptions that can be properly handled
- 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.
- Protect your intelectual property and your applications. Compiled .Net assemblies, if done properly, are very difficult to tamper with. Move the key parts of you application into an assembly to prevent unauthorised use of your code.
The NetPhp library is made up of two elements:
- Some PHP class libraries open sourced at https://github.com/david-garcia-garcia/netphp
- The NetPhp binary wrapper. This is a dynamic link library (.dll) that fills the gap between the dotnet PHP extensions and the .Net framework.
Professional (€125): Unlimited usage + access to the source code*
Instructions: after purchase send an e-mail to firstname.lastname@example.org with a Gitlab e-mail address of your choice. This address/account will be given access to a private GIT repository with the source code for a duration of 1 year. All updates to the product during the duration of access to the repository are included in the license. You can keep using the code after the period.
* You are allowed to use and modify the source code, and to embed the binaries into your applications, but not to redistribute, re-license or make any of them (source code or binaries) publicly available. You are given access to the private Gitlab repository.
Every activation comes with a lifetime free minor version updates. You need to buy new licenses if you wish to upgrade to a new Major version.
Before deciding to purchase our software, please be sure to download, install, and test-drive the evaluation versions that we provide.
We do not offer refunds on software where the unlock code has already been sent to the customer. We go to great lengths to produce a trial version with which customers can ensure their satisfaction and system compatibility. This allows them to make an informed purchasing decision. Once that purchase has been made, we do not offer a cash refund or an exchange. We feel this policy is consistent with the major software retailers. You are expected to be satisfied before purchasing.
You can download the NetPhp binary - fully functional - to test the product:
NOTE: If using PHP7 we recommend sticking to the x64 version of PHP. We have found stability issues related to memory management when using PHP7x86 to call assemblies that are writen in unmanaged code.
Copyright (C) 2016 David García García - david dot garcia at drupalonwindows dot com
This program is not free software: you can use it and modify it but not convey it or any derivate works.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
A full copy of the license can be obtained here: http://www.drupalonwindows.com/en/content/paidware-terms-and-conditions
- Fix bug: iterators with native types return unwrapped objects.
- Fixed bug introduced in 22.214.171.124 where parameters with null values produced unhadled exceptions.
- Easy type retrieval from wrapped objects.
- Improve method detection (more method calls working now, specially when the .Net runtime is unable do determine the appropriate method to call)
- Add automatic support for IDisposable
- Add support for runtime properties and fields
- Support for optional arguments in methods
- Support for ambiguous method match detection
- Add support for runtime properties and fields
- Temporary file path is now configurable by the user.
- Removed evaluation version protection from runtime constructor: this was confusing and annoying.
- Revise method, property and field invocations to make dealing with non .Net object (COM) easier.
- Add cron callback for cleanup tasks.
- Expose registry clean tool as part of the runtime.
- Fixed assembly cache failing with unhandled exception for some assemblies
- Fixed runtime throwing exception when declared method return types did not perfectly match the real object type but both were compatible.
- Fixed bug introduced in 126.96.36.199 where automatic assembly discovery stopped working.
- Additional test coverage.
- Fixed bug where fallback method detection was throwing an unhandled exception instead of propagating the missing method exception.
- Fixed bug where the library was not properly reporting license type (Full vs Evaluation)
- Improved performance.
- Improved assembly discovery to cope with situations where .Net is not able to automatically resolve a dependency.
- Print original error message whe COM instantiation fails.
- Added the ability to register an assembly when you only know the ProgId of a COM type
- Modify licensing storage so that the system registry is not used
- Complete refactor
- Better performance and more robust
- Added PHP class generator
UPGRADE NOTICE: The 2.x version of the binary is not backwards compatible with 1.x code. If you are upgrading from the 1.x branch make sure that you completely unregister the COM+ component of you previously registered binary before deploying the new one. If you don't do so, or plan on using the 2.x binary side to side with the 1.x binary, you will need to instantiate the components using their unique ClassId instead of the ProgramId. Please se the user guide for additional details.
- Improve exception throwing when calling a method and parmeter number and types do not match any overload.
- Improved version limitation messages to make it clear that this is a license issue.
- MagicWrapper->PropertyGet/PropertySet now are able to operate on fields, and provide better feedback when the field/property is not found.
- MagicWrapper->WrapOver now does automatic type detection (when possible).
- MagicWrapper->WrapOver now verifies that provided type and instance match (when a type is provided and the instance is not null).
- Added tests to make sure that Fields, Properties and Constants can be manipulated through PropertyGet/PropertySet (when applicable).
- Always reset internal type whe doing MagicWrapper->TypeFromName() or TypeFromName->TypeFromFile() to allow reusage of MagicWrapper instances.
- Added methods to retrieve assembly version and license type.
- Lazy type instrospection was not triggered when calling methods, preventing calls on static methods to work if the type had not been loaded by another operation.
- Add recovery to catastrophic library load to prevent a hung process holding hostage a .dll file.
- Only initialize iterators when doing the first rewind.
- Add collection internal type detection to get native types when iterating.
- Improve Type metadata to inspect iterable current() return type.
- Add support for PHP array access interface for .Net IDictionary, Array and IList
- Added tests for ABCpdf library.
- Throw exception before trying to load a binary that does not exist to ease troubleshooting.
- Object method calls were not properly detecting different overrides.
- Allow to obtain instances without wrapper (only if they have the COM Visible attribute)
- MagicWrapper->iterator_current() was not properly propagating errors.
- MagicWrapper->iterator_rewind() renew instead of rewinding internal enumerator.
- Added tests for iterators.
- MagicWrapper->iterator_key() should return unwrapped values if they are PHP Native.
- Initial release
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OWNERS AND/OR DISTRIBUTORS OF THE LIBRARY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.