Workbook, Worksheet, Cells, and Cell — the same core objects developers already know from Aspose’s other Cells FOSS libraries. Create a new workbook or load an existing one, write and read cell values and formulas, apply fonts, fills, borders, and alignment through the Style class, and configure page setup (margins, orientation, scaling, print area) through PageSetupModel. The library is MIT-licensed and requires only PHP’s own zip, dom, simplexml, and mbstring extensions — no native Office libraries, no COM automation, no compiled dependencies. Install it by cloning the repository and requiring its bundled autoload.php directly — no build step or package manager is involved (see the Quick Start example below). For the enterprise product family, see Aspose.Cells — Enterprise Product Family.Workbook or load an existing .xlsx file.Cells["A1"]->PutValue(...) bracket-style indexing.=SUM(B2:B3)) stored verbatim in the saved file.LoadOptions exposes TryRepairPackage and TryRepairXml to recover from a damaged source file before it is fully parsed.Workbook->LoadDiagnostics reports data-loss risk discovered while loading..xlsx reports directly from PHP application data.Style, Font, Color, and FillPattern.GetStyle() before modifying and reapplying it with SetStyle().PageSetupModel.Validation-related classes model cell-level data validation rules.Aspose.Cells FOSS for PHP requires PHP 8.1 or later and the zip, dom, simplexml, and mbstring extensions — all either built into standard PHP distributions or widely available. Install it by cloning the repository and requiring its bundled autoload.php directly (see the Quick Start example below); no build step or compiled dependency is involved.
The library is a structural port of Aspose.Cells FOSS for .NET, so method names follow the same PascalCase convention as that library rather than typical PHP camelCase. It is MIT-licensed, hosted on GitHub, and accepts bug reports and pull requests.
Create a new Workbook, write values and a formula to cells, apply a bold white-on-blue header style, and save the result as .xlsx. This example was run against the real library as part of this launch’s verification.
git clone https://github.com/aspose-cells-foss/Aspose.Cells-FOSS-for-PHP.git
cd Aspose.Cells-FOSS-for-PHP
composer installuse Aspose\Cells_FOSS\Color;
use Aspose\Cells_FOSS\FillPattern;
use Aspose\Cells_FOSS\Workbook;
$workbook = new Workbook();
$sheet = $workbook->Worksheets[0];
$sheet->Name = 'Products';
$sheet->Cells['A1']->PutValue('Product');
$sheet->Cells['B1']->PutValue('Price');
$sheet->Cells['A2']->PutValue('Apple');
$sheet->Cells['B2']->PutValue(2.99);
$sheet->Cells['A3']->PutValue('Orange');
$sheet->Cells['B3']->PutValue(1.99);
$sheet->Cells['B4']->Formula = '=SUM(B2:B3)';
$headerStyle = $sheet->Cells['A1']->GetStyle();
$headerStyle->Font->IsBold = true;
$headerStyle->Font->Color = Color::FromArgb(255, 255, 255, 255);
$headerStyle->Pattern = FillPattern::Solid;
$headerStyle->ForegroundColor = Color::FromArgb(255, 34, 120, 212);
$sheet->Cells['A1']->SetStyle($headerStyle);
$sheet->Cells['B1']->SetStyle($headerStyle);
$workbook->Save('products.xlsx');
Load an existing .xlsx file with package- and XML-level repair enabled, check the load diagnostics for data-loss risk, then modify and re-save it. This example was also run against the real library as part of this launch’s verification.
use Aspose\Cells_FOSS\LoadOptions;
use Aspose\Cells_FOSS\Workbook;
$loadOptions = new LoadOptions();
$loadOptions->TryRepairPackage = true;
$loadOptions->TryRepairXml = true;
$loadOptions->StrictMode = false;
$workbook = new Workbook('input.xlsx', $loadOptions);
if ($workbook->LoadDiagnostics->HasDataLossRisk) {
echo 'Potential data loss risk detected during load.' . PHP_EOL;
}
$workbook->Worksheets[0]->Cells['A1']->PutValue('Updated');
$workbook->Save('updated.xlsx');
PHP 8.1 or later, with the zip, dom, simplexml, and mbstring extensions enabled.
No. The library is pure PHP; no native extensions beyond the standard ones listed above.
git clone https://github.com/aspose-cells-foss/Aspose.Cells-FOSS-for-PHP.git — see the Installation Guide for the full steps: clone the repository and require the bundled autoload.php.
Only .xlsx (Excel Open XML). There is no .xls, .csv, or .ods support in this release.
No. The Formula property on Cell stores the formula text as-is; the value is recalculated by Excel or another spreadsheet application when the file is opened.
No. Aspose.Cells FOSS for PHP is distributed under the MIT License (the license text is included in the repository) with no license key or activation step required to use the library.
Pass a LoadOptions instance with TryRepairPackage and TryRepairXml set to true to the Workbook constructor, then check $workbook->LoadDiagnostics->HasDataLossRisk after loading.