1. Go to this page and download the library: Download apsonex/font library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
apsonex / font example snippets
use Apsonex\Font\Font;
// Instantiate the font manager
$fontManager = Font::make();
// Select Bunny provider
$fontManager->bunny();
// List fonts (paginated)
$response = $fontManager->list(limit: 20, page: 1);
foreach ($response->fonts as $font) {
echo $font->family . PHP_EOL;
}
// Search fonts by keyword
$searchResponse = $fontManager->search('abo', limit: 20, page: 1);
// Find font by a single key
$font = $fontManager->findByKey('abel');
// Find fonts by multiple keys
$response = $fontManager->findByKeys(['abel', 'abeezee'], limit: 10);
// Find fonts by family
$response = $fontManager->findByFamily('Abel', limit: 10);
// Find fonts by multiple families
$response = $fontManager->findByFamilies(['Abel', 'Aboreto'], limit: 10);
// Find fonts by type (e.g., 'sans-serif')
// Use limit -1 to fetch all matches
$response = $fontManager->findByType('sans-serif', limit: -1);
use Apsonex\Font\Contracts\FontProviderInterface;
class YourProvider implements FontProviderInterface
{
public function list(int $limit, int $page): FontResponse { /*...*/ }
public function search(string $keyword, int $limit, int $page): FontResponse { /*...*/ }
public function findByKey(string $key): ?FontDTO { /*...*/ }
// Implement other methods from interface...
}
$fontManager->useProvider(new YourProvider());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.