company4-dev / ico
An easy-to-use library to generate valid ICO files.
1.8
2026-11-16 18:10 UTC
Requires
- php: >=8.3
- ext-gd: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
ICO allows you to generate .ico files from pre-existing images.
Installation
composer require company4-dev/ico
Usage
Set-up the ICO
| Parameter | Type | Default | Description |
|---|---|---|---|
$in |
string |
null |
The path to the source image file |
$out |
string |
null |
Path to the target ICO file, if null, the file will be saved to the same location, but with a .ico extension. |
$sizes |
array |
[] |
An array of sizes that the source image should be rendered at in the generated ICO file. If sizes are not supplied, sizes 16px2, 24px2, 32px2, 48px2, 256px2 will be used. |
use Company4\Ico\Ico; $ico = new ICO( $path, [ [16, 16], [32, 32], [48, 48], [64, 64], ] ); $ico->save($target);
With Thanks
Credit to Chris Jean who can take credit for base of the src/ico.php file.