zpmlabs/undraw-php
最新稳定版本:v1.0.3
Composer 安装命令:
composer require zpmlabs/undraw-php
包简介
Tiny client for undraw.co search (Next.js data routes) returning DTOs and SVG code on demand.
README 文档
README
Lightweight client for undraw.co search (using Next.js data routes).
Returns typed DTOs and lets you fetch SVG code.
Install
composer require ZPMLabs/undraw-php # You also need a PSR-18 client & PSR-17 factories (Discovery will find them). # Example: composer require guzzlehttp/guzzle nyholm/psr7
Usage
use Undraw\Factory\UndrawFactory; $client = UndrawFactory::create(); // in-memory cache by default $results = $client->search('music', 10); // array of Undraw\DTO\Illustration foreach ($results as $i) { echo $i->title . ' => ' . $i->mediaUrl . PHP_EOL; $svg = $client->getSvg($i); // raw SVG string }
With Laravel
use Undraw\Factory\UndrawFactory; use Undraw\UndrawClient; use Undraw\Support\Laravel\LaravelCacheAdapter; app()->bind(UndrawClient::class, function () { return UndrawFactory::create(new LaravelCacheAdapter()); });
With Filament
Select::make('undraw_media') ->searchable() ->getSearchResultsUsing(function (string $search) { /** @var \Undraw\UndrawClient $u */ $u = app(\Undraw\UndrawClient::class); return collect($u->search($search, 20)) ->mapWithKeys(fn($i) => [$i->mediaUrl => $i->title]) ->all(); }) ->hint('Search undraw…');
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-28