helgesverre/brandfetch-sdk
Composer 安装命令:
composer require helgesverre/brandfetch-sdk
包简介
Laravel SDK for Brandfetch
README 文档
README
Laravel SDK for Brandfetch
Laravel SDK for interacting with the Brandfetch API, get your API key from the developer portal.
Installation
You can install the package via composer:
composer require helgesverre/brandfetch-sdk
Then add your API key to your .env file.
BRANDFETCH_API_KEY="your-api-key"
You can publish the config file with:
php artisan vendor:publish --tag="brandfetch-sdk-config"
This is the contents of the published config file:
return [ "brandfetch_api_key" => env("BRANDFETCH_API_KEY") ];
Usage
Retrieve a brand
// Create your own instance $brandfetch = new HelgeSverre\Brandfetch(apiKey: "your-api-key"); // Or use the facade use HelgeSverre\Brandfetch\Facades\Brandfetch; $brand = Brandfetch::retrieveBrand("brandfetch.com")->json()
Retrieve a brand as a DTO
You can alternatively use the ->dto() method to retireve a Spatie/Data DTO Object, which provides better auto-complete
support etc.
$brand = Brandfetch::retrieveBrand("brandfetch.com")->dto()
Response DTO
The retrieveBrand()->dto() method returns a Brand DTO with the following properties:
name: ?string - The name of the brand.domain: string - The domain associated with the brand.claimed: bool - Whether the brand has been claimed.description: ?string - A short description of the brand.longDescription: ?string - A longer description of the brand.links: ?DataCollection ofLink- A collection of links related to the brand, each containing:name: string - The name of the link.url: string - The URL of the link.
logos: ?DataCollection ofLogo- A collection of logos associated with the brand, each containing:theme: ?string - The theme of the logo.formats: DataCollection ofFormat- The available formats of the logo, each containing:src: string - The source URL of the format.background: ?string - The background color of the format.format: string - The format type (e.g., 'png', 'svg').size: ?int - The size of the format.height: ?int - The height of the format.width: ?int - The width of the format.
tags: array - Tags associated with the logo.type: string - The type of the logo.
colors: ?DataCollection ofColor- A collection of colors used by the brand, each containing:hex: string - The HEX code of the color.type: string - The type of the color (e.g., 'primary', 'secondary').brightness: int - The brightness of the color.
fonts: ?DataCollection ofFont- A collection of fonts used by the brand, each containing:name: ?string - The name of the font.type: ?string - The type of the font.origin: ?string - The origin of the font.originId: ?string - The origin ID of the font.
images: ?DataCollection ofImage- A collection of images associated with the brand, each containing:formats: DataCollection ofFormat- The available formats of the image, each containing:src: string - The source URL of the format.background: ?string - The background color of the format.format: string - The format type (e.g., 'png', 'svg').size: ?int - The size of the format.height: ?int - The height of the format.width: ?int - The width of the format.
tags: array - Tags associated with the image.type: string - The type of the image.
Search for a Brand
$brand = Brandfetch::searchBrand("brandfetch.com")->dto()
Response DTO
The searchBrand()->dto() method returns a collection of SearchResult DTOs:
name: ?string - The name of the brand.domain: string - The domain associated with the brand.claimed: bool - Whether the brand has been claimed.icon: ?string - The icon of the brand.
You can take a look at the DTOs here
Testing
composer test
Credits
License
The MIT License (MIT). Please see License File for more information.
Disclaimer
NOTE: This is not an official product from Brandfetch.
All logos, brands, and trademarks mentioned herein belong to their respective owners. The "Brandfetch" name, logo, and brand are trademarks of "Brandfetch SA". This project and its creator are not affiliated with, endorsed by, sponsored by, or associated with "Brandfetch SA" or any other entities mentioned in this documentation. All rights reserved to the respective trademark owners. Use of these names, logos, and brands does not imply endorsement and is purely illustrative.
helgesverre/brandfetch-sdk 适用场景与选型建议
helgesverre/brandfetch-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.57k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2023 年 10 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「helgesverre」 「brandfetch-sdk」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 helgesverre/brandfetch-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 helgesverre/brandfetch-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 helgesverre/brandfetch-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Automatically upgrade Heroicons v1 to v2 icon names in Blade templates
Scrape Norwegian Phone directories with Laravel.
Alfabank REST API integration
Laravel package for Accurate Online API integration.
Shared RCX Laravel DataTables UI and configuration helpers.
Boot a Laravel project on any machine with one command: app:serve installs missing tools (PHP, Node, Composer, Herd, Docker), creates .env, sets up the database, runs migrations, builds assets, starts a queue worker and serves via Herd, Sail or artisan serve; app:down cleanly stops everything it sta
统计信息
- 总下载量: 1.57k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-21
