apsonex / laravel-font
This is my package laravelfont
v1.0.3
2025-05-26 17:50 UTC
Requires
- php: ^8.2
- apsonex/font: ^1.0.4
- illuminate/contracts: ^10.0||^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
This package is auto-updated.
Last update: 2025-05-26 17:50:55 UTC
README
apsonex/laravelfont
is a Laravel wrapper around the core apsonex/font
package, allowing you to easily manage fonts from supported providers like Bunny Fonts.
โจ Features
- List, search, and retrieve fonts by key, family, or type.
- Support for Bunny Fonts.
- Laravel auto-discovery with service provider and facade.
- Clean, chainable API.
- Ready for testing using Pest PHP.
๐ Installation
composer require apsonex/laravelfont
๐ Usage
Resolving the Font Manager
use Apsonex\LaravelFont\Facades\LaravelFont; $manager = LaravelFont::bunny();
Or via service container:
$manager = app(\Apsonex\LaravelFont\LaravelFontManager::class)->bunny();
๐ API Methods
Set Provider
$manager->bunny();
List Fonts
$manager->list(limit: 20, page: 1);
Search Fonts
$manager->search(keyword: 'abo', limit: 20, page: 1);
Find by Key
$manager->findByKey('abel');
Find by Keys
$manager->findByKeys(['abel', 'aboreto'], limit: 10);
Find by Family
$manager->findByFamily('Abel', limit: 10);
Find by Families
$manager->findByFamilies(['Abel', 'Aboreto'], limit: 10);
Find by Type
$manager->findByType('sans-serif', limit: -1); // -1 to get all
๐ FontDTO
Each font is returned as a FontDTO
with the following structure:
FontDTO { string $key // "abel" string $provider // "bunny" string $category // "sans-serif" string $family // "Abel" string $urlString // "abel:400,400i" }
๐งช Testing
Run the test suite using:
vendor/bin/pest
๐ Development
If you're working on this package, install dependencies and test it via:
composer install
composer test
๐ License
The MIT License (MIT). Please see License File for more information.