C.89 ZendGuardEncodeTask
Prev | Appendix C. Optional tasks | Next

## C.89 ZendGuardEncodeTask

The `ZendGuardEncodeTask` is a wrapper for ZendGuard zendenc executable. It pre-compiles the PHP code which improves speed and can prevent unauthorized code modification. Additionally it allows signing or licensing the code so it can only be used with a valid license.

For more information about ZendGuard encode parameters see the ZendGuard documentation.

Table C.119: Attributes

Name | Type | Description | Default | Required
--- | --- | --- | --- | ---
`zendEncoderPath` | `String` | Path to zendenc or zendenc5 binary. | n/a | Yes
`deleteSource` | `Boolean` | Whether to delete the original file and replace with encoded. | `true` | No
`renameSourceExt` | `String` | If defined the original file will be copied to originalfile.renameSourceExt before encoding. This property overrides the deleteSource property. | n/a | No
`shortTags` | `Boolean` | Turns on/off support for PHP short tags (<?). True to enable support. | `true` | No
`aspTags` | `Boolean` | Turns on/off support for ASP tags (<%). True to enable support. | `false` | No
`noHeader` | `Boolean` | Disables the PHP-compatible header that is added to the top of every encoded file by default and is displayed if the Zend Optimizer is not properly installed. | `false` | No
`useCrypto` | `Boolean` | Enables cryptography support. | `false` | No
`encodedOnly` | `Boolean` | If enabled the encoded files will only work with other encoded files ( I.e. encoded and not-encoded files cannot be used together). | `false` | No
`forceEncode` | `Boolean` | Allow encoding previously encoded files. Not recommended. | `false` | No
`expires` | `String` | Make an encoded file to expire on the given data. Date is in yyyy-mm-dd format. | n/a | No
`obfuscationLevel` | `Integer` | Level of obfuscation. Defaults to 0 (no obfuscation). | 0 | No
`optMask` | `Integer` | Optimization mask. Integer representing a bit mask. | n/a | No
`privateKeyPath` | `String` | Path to the company private key. This is required when either signProduct or licenseProduct is enabled. | n/a | No
`licenseProduct` | `Boolean` | Enabled product licensing. The encoded files won't work without a valid license. If enabled privateKeyPath property also needs to be defined. | `false` | No
`signProduct` | `Boolean` | Enabled product signing. If signing is enabled the files will be encoded with license support. However valid license won't be required for the files to work. If enabled privatKeyPath property also needs to be defined. | `false` | No
`productName` | `String` | Name of the product. This must match the product name in the license and is required when either licenseProduct or signProduct is enabled. | n/a | No
`prologFile` | `String` | Path to a file containing a text that will be prepended to each encoded file and displayed in case the Zend Optimizer is not installed. | n/a | No

### C.89.1 Example

    <zendguardencode
     shortTags="false"
     productName="Phing"
     privateKeyPath="/var/data/phing.key"
     licenseProduct="true"
     zendEncoderPath="/usr/local/Zend/ZendGuard-5_0_1/bin/zendenc5"
     >

     <fileset dir="src">
       <include name="**/*.php" />
       <exclude name="cache/**" />
       <exclude name="plugins/**" />
     </fileset>

     <fileset dir="src">
       <include name="plugins/cs*/**/*.php" />
       <include name="plugins/cs*/*.php" />
     </fileset>
    </zendguardencode>

Encode all php files in the current directory and subdirectories. Exlude everything in `cache/` and `plugins/` but include everything in plugins that starts with cs.

### C.89.2 Supported Nested Tags

- `fileset`

Prev | Up | Next
C.88 ZendCodeAnalyzerTask | Home | C.90 ZendGuardLicenseTask