PHP Encoders, Zend Guard, and PHP 7: An Overview
This blog explores why you might use a PHP encoder. It also covers the history of Zend's PHP encoder, Zend Guard, and PHP 7.
What Is a PHP Encoder?
A PHP encoder protects the source code of an app.
Why PHP Encoders Were Needed
Here's how PHP encoders came about.
PHP's growth rate was incredible. We had a hard time believing the statistics from Netcraft. The numbers continued to show increasing adoption. And we continued to get more requests for a PHP encoder. Organizations needed a PHP encoder that protected the source code of the apps they sold. However, there were some technology barriers.
Despite its advanced features, PHP 3 had some significant shortcomings. One of the key deficiencies was its execution engine. As application complexity increased, engine performance declined. This made it infeasible to distribute a PHP app in any form other than its original source code.
This changed with PHP 4, which came out in mid-2000. PHP 4 includes the first version of the Zend Engine. And this execution engine resembles in many ways the execution engine that is in PHP 7.
What Zend Engine Does
The Zend Engine compiles PHP source code into an in-memory representation, called intermediate code.
A separate component then iterates over this intermediate code and executes it. Even though the engine has since evolved, it still operates the same way. And the appearance of intermediate code, hasn't changed.
Adding Zend Engine as the new PHP execution model enabled huge performance gains. PHP 4 is dramatically faster than PHP 3.
Adding Zend Engine to PHP 4 also paved the way to language-plugins. They can tie into the execution engine and perform ‘brain surgery’ on it. For example, with plugins, PHP users can take advantage of concepts like:
- Opcode cache.
- Whitebox performance monitoring./li>
- Executing apps distributed in forms other than source code.
Zend Compiler to Zend Encoder to Zend Guard
With the market demand established and the technological barrier removed via Zend Engine, we created a PHP encoder called Zend Compiler.
As the years went by, the Zend Compiler evolved. We renamed it Zend Encoder. And later, when we added source code and licensing capabilities, we renamed it to Zend Guard.
Zend Guard dates back to 2001. It was the first commercial product Zend offered and it drove the creation of the company. The idea for the product came from the massive numbers of companies who used PHP 3 during the dotcom boom.
After much deliberation, we’ve decided not to port Zend Guard to PHP 7 and beyond.
Why the Product Change?
Zend Guard has been a successful product for us and serves thousands of customers. As the company continues to evolve, our focus has shifted on two key areas:
Improving the experience of product, business-critical apps.
- Boosting developer productivity.
While Guard is not a high-maintenance product, we had to invest resources to port it to the new PHP version. We wanted to keep resources focused on our key areas and improvements in key products.
The release of PHP 7 made this decision clear. It has the most extensive internals refactoring since the transition from PHP 3 to 4. The effort to port Guard to support PHP 7 was much greater than the efforts needed to port Guard to PHP 5.5 or 5.6.
Open development around PHP is also increasing. The jump in adoption is greater than what we saw with the introduction of Composer. Modern PHP apps tend to have fewer proprietary components. And applications tend to be offered as a service, and/or exposed through APIs, which means that neither executable nor source code are distributed. And so, we are seeing a gradual decline in the need for a PHP encoder like Zend Guard.
The decision to focus on improving our core technologies — Zend Server and Z-Ray — and not port Guard to PHP 7 was difficult. Zend Guard was the product that led to the founding of our company. Yet we know, it's the right decision.
What Does This Change Mean for You?
This is the easy part. Zend Guard is still available on our store. If you’re using it to protect your PHP 5 applications, you can continue using it. We’ll continue supporting it. We have a team that can answer questions and help you get the most out of it.
We also offer long-term support for PHP 5 and PHP 7. Learn more about it.