承接 apsonex/font 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

apsonex/font

Composer 安装命令:

composer require apsonex/font

包简介

Font

关键字:

README 文档

README

A simple PHP package to manage and search fonts from multiple providers. Currently supports the Bunny Fonts provider with an easy way to list, search, and filter fonts.

Features

  • List fonts with pagination
  • Search fonts by keyword
  • Find fonts by key(s), family(ies), and type
  • Extensible with multiple font providers

Installation

composer require apsonex/font-manager

Usage

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);

API Reference

Font Manager (Apsonex\Font\Font)

  • make(): static — Create a new instance
  • bunny(): static — Use Bunny font provider
  • useProvider(FontProviderInterface $provider): static — Use a custom font provider
  • list(int $limit = 20, int $page = 1): FontResponse — List fonts paginated
  • search(string $keyword, int $limit = 20, int $page = 1): FontResponse — Search fonts by keyword
  • findByKey(string $key): ?FontDTO — Find a single font by key
  • findByKeys(array $keys, int $limit = 20): FontResponse — Find fonts by keys
  • findByFamily(string $family, int $limit = 20): FontResponse — Find fonts by family
  • findByFamilies(array $families, int $limit = 20): FontResponse — Find fonts by families
  • findByType(string $type, int $limit = -1): FontResponse — Find fonts by category/type

FontDTO (Apsonex\Font\FontDTO)

  • Represents a single font object with these properties:
  • key (string): Unique font key
  • provider (string): Provider name
  • category (string): Font category (e.g., sans-serif)
  • family (string): Font family name
  • urlString (string): CSS font string identifier

The FontDTO class represents a single font item with key metadata used across the package.

Property Type Description Example
key string Unique identifier for the font "abeezee"
provider string The font provider source "bunny"
category string Font category/type (e.g., serif, sans-serif) "sans-serif"
family string The font family name "ABeeZee"
urlString string A URL-friendly CSS font string used for loading "abeezee:400,400i"
use Apsonex\Font\FontDTO;

// Creating a FontDTO object (usually returned from provider methods)
$font = new FontDTO(
    key: 'abeezee',
    provider: 'bunny',
    category: 'sans-serif',
    family: 'ABeeZee',
    urlString: 'abeezee:400,400i'
);

// Accessing properties
echo "Font Key: " . $font->key . PHP_EOL;             // Output: abeezee
echo "Provider: " . $font->provider . PHP_EOL;        // Output: bunny
echo "Category: " . $font->category . PHP_EOL;        // Output: sans-serif
echo "Family: " . $font->family . PHP_EOL;            // Output: ABeeZee
echo "CSS URL String: " . $font->urlString . PHP_EOL; // Output: abeezee:400,400i

FontResponse (Apsonex\Font\FontResponse)

  • Paginated font response containing:
  • fonts (array of FontDTO)
  • total (int) — total matched fonts
  • limit (int) — items per page
  • page (int) — current page number

Testing

This package uses Pest PHP for testing.

./vendor/bin/pest

Extending with other Providers

You can implement your own provider by creating a class that implements:

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...
}

Then register it:

    $fontManager->useProvider(new YourProvider());

License

MIT License © Apsonex Inc

Contributing

Feel free to open issues and pull requests!

apsonex/font 适用场景与选型建议

apsonex/font 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 974 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「font」 「apsonex」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 apsonex/font 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 apsonex/font 我们能提供哪些服务?
定制开发 / 二次开发

基于 apsonex/font 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 974
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 21
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-26