PHP developers may make use of Aspose.Cells for Java in their PHP applications. To work with Aspose.Cells for Java from PHP, it's better for developers to use PHP version 5 (shortly known as PHP5). PHP4 can also be used to access Aspose.Cells for Java but it's more complex than using PHP5.
Using PHP5
Aspose.Cells for Java provides PHP5 Wrapper Classes that make it easier for developers to use Aspose.Cells library without working with Java classes directly by themselves. These wrapper classes can be found in the PHP directory of aspose.cells.zip archive in the form of a PHP file.
Using PHP4
PHP4 also works with Aspose.Cells for Java but in this case, developers would need to work with Java classes directly by themselves.
Note:
Don't forget to add aspose.cells.jar to java.class.path in the php.ini file.
PHP Wrapper Classes has provided some static methods to create PHP Class for corresponding Java Class, in ClassFactory with signature createXXX(). If the constructors are overloaded,all corresponding methods in ClassFactory are defined as create+serial number+class name,such as : createXXX(), create1XXX(args...), create2XXX(args...), and so on.
All Constants are defined in PHP as CalssName+""+ConstantName, for example, BorderLineType.NONE is defined as BorderLineTypeNONE in PHP.
If the methods are overloaded, the methods are defined as method name + serial number. Such as cell.setValue,cell.setValue1(),cell.setValue2(),and so on.
The clone() method is defined as cloneObject().
Example:
<?php
require_once("java/Java.inc");
require("AsposeCells.php");
$workbook = ClassFactory::createWorkbook();
$workbook->open5("t1.xls");
$cell = $workbook->getWorksheets()->getSheet(0)->getCells()->getCell1(0, 0);
$cell->setValue6("Hello World!");
$workbook->save5("t.xls");
?>