承接 mvpasarel/typekit-php 相关项目开发

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

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

mvpasarel/typekit-php

Composer 安装命令:

composer require mvpasarel/typekit-php

包简介

PHP wrapper for Typekit Developer API

关键字:

README 文档

README

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Typekit Client implementation with PHP

Install

Via Composer

$ composer require mvpasarel/typekit-php

Usage

Initialize the client with your developer API token. You can get your API token here. All method calls return the JSON representation of the return from calling the Typekit API.

$typekit = new \Mvpasarel\Typekit\TypekitClient('<API token>');

Get all kits

To get all your kits, use the following command:

$typekit->getKits();

Get kit

To get information about a specific kit, input the kit id as the argument:

$typekit->getKit($kitId);

Create kit

To create a new kit, use the method createKit($name, $domains, $families). Name and domains fields are required, but the families field is not.

The arguments are in the following format:

  • $name: string
  • $domains: PHP array of strings of format array('localhost', '*.domain.com', '127.0.0.1')
  • $families: set of arrays with the following key => values
    • 'id' : font family id (string)
    • (optional) 'variations' : comma separated variations (string).

An example of the families format is: $families = array(array('id' => 'ftnk', 'variations' => 'n3,n4'), array('id' => 'pcpv', 'variations' => 'n4')) in which case we would create a kit with the font families Futura-PT and Droid Sans with font variations normal 3 ($font-weight:300 and not italicized or strong), normal 4 and normal 4, respectively.

Example usage:

$name = 'example typekit kit';

$domains = array('localhost', '*.domain.com');

$families = array(array('id' => 'ftnk', 'variations' => 'n3,n4'), array('id' => 'pcpv', 'variations' => 'n4'));

$typekit->createKit($name, $domains, $families);

Update kit

To create a new kit, use the method updateKit($kitId, $name='', $domains=array(), $families=array()). The only required field is $kitId and name. domains and families fields are not required.

Field formats are the same as createKit.

Example usage:

$name = 'Example';

$typekit->updateKit($kitId, $name);

Remove kit

To remove a kit, use the method removeKit($kitId). The $kitId field is required.

$typekit->removeKit($kitId);

Publish kit

To publish a kit, use the method publishKit($kitId). The $kitId field is required.

$typekit->publishKit($kitId);

Get font family

To retrieve information regarding a given font family, use the method getFontFamily($font). The argument font is a string and can be a Typekit font id or a slug of the font as named in Typekit. The method does not slugify the input, so make sure to slugify it before entering the argument.

$typekit->getFontFamily('<font_id>');

Get font variations

To retrieve all possible variations of a given font, use the method getFontVariations($font). The argument is the same as for getFontFamily($font). This method returns a PHP array of all possible variations of the font.

$variations = $typekit->getFontVariations('futura-pt'); # using font slug

or

$variations = $typekit->getFontVariations('ftnk'); # using font id

OUTPUT:
array('n3', 'i3', 'n4', 'i4', 'n5', 'i5', 'n7', 'i7', 'n8', 'i8')

Add font to kit

To add font to kit, use the method kitAddFont($kitId, $font, $variations). Arguments for this method is the same format as the ones above, BUT variations should be in array. Returns nothing.

$typekit->kitAddFont('$kitId', 'futura-pt', array(n3,n5,n7));

Remove font from kit

To add font to kit, use the method kitRemoveFont($kitId, $font). Arguments for this method is the same format as the ones above, BUT variations should be in array. Returns nothing.

$typekit->kitRemoveFont($kitId, 'futura-pt');

Other methods

getKitValues($kitId) - Retrieves kit values in an array of format: [$name, $domains, $families]

getKitFonts($kitId) - Retrieves an array of font ids in a given kit

kitContainsFont($kitId, $font) - Checks to see if a font exists in a kit.

Testing

$ TYPEKIT_TOKEN=<API token> phpunit

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please use Contact Form instead of using the issue tracker.

Credits

Thanks to

License

The MIT License (MIT). Please see License File for more information.

mvpasarel/typekit-php 适用场景与选型建议

mvpasarel/typekit-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.38k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2015 年 03 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 mvpasarel/typekit-php 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 7.38k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-13