While there are a large number of extensions available for PHP, a particular few stand out because they are technology extensions as opposed to just library extensions. That is, they allow you to make use of a particular technology from inside PHP, as if you were using it directly.
The most interesting of these extensions are the Java and COM extensions, because they give you a very simple interface into these powerful technologies, allowing you to make use of their functionality without straying too far away from PHP. Java, particularly, is seen as being an interesting match for PHP because they are both cross-platform, and both Internet-based.
Microsoft's Component Object Model (COM) system is available for Windows only, so Unix users will need to get by with just Java. If you are using Windows, and do not mind restricting your scripts to Windows only, then you can have lots of fun exploring how COM and PHP can fit together.
This chapter is devoted to exploring how you can mix in these two popular buzzwords with PHP - not just on a theoretical, "look what I can do" level, but also for practical benefit in your scripts. PHP is a great language, but you should never let that stop you from taking bits and pieces from other technologies wherever it will improve your scripts. Having said that, I like trying things out - even crazy things - for kicks now and then, and I hope that's been reflected here too.
Topics covered in this chapter are:
How to use COM
Finding out what components you have installed
Advanced COM - controlling Internet Explorer, and even writing VBScript
Distributed COM: COM over a network
Running Java in your scripts
Creating interfaces with Swing
Want to learn PHP 7?
Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!
If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!
Next chapter: Getting started with COM >>
Previous chapter: Next chapter
Home: Table of Contents
Copyright ©2015 Paul Hudson. Follow me: @twostraws.