brandonjjon/laravel-printavo
Composer 安装命令:
composer require brandonjjon/laravel-printavo
包简介
Laravel package providing an Eloquent-like interface to the Printavo GraphQL API
README 文档
README
A Laravel package providing an Eloquent-like interface to the Printavo GraphQL API. Query customers, orders, invoices, and more using familiar Laravel patterns.
Installation
Install the package via Composer:
composer require brandonjjon/laravel-printavo
Publish the configuration file:
php artisan vendor:publish --tag="printavo-config"
Configuration
Add your Printavo API credentials to your .env file:
PRINTAVO_EMAIL=your-email@example.com PRINTAVO_TOKEN=your-api-token
You can find your API credentials in your Printavo account settings under API Access.
Optional Configuration
# Caching (enabled by default) PRINTAVO_CACHE_ENABLED=true PRINTAVO_CACHE_TTL=300 PRINTAVO_CACHE_STORE=redis # Rate limiting (10 requests per 5 seconds by default) PRINTAVO_RATE_LIMIT_REQUESTS=10 PRINTAVO_RATE_LIMIT_SECONDS=5 PRINTAVO_RATE_LIMIT_BEHAVIOR=wait # or 'throw'
Usage
Basic Queries
use Brandonjjon\Printavo\Facades\Printavo; // Get all customers (returns Collection) $customers = Printavo::customers()->get(); // Collection methods work as expected $count = $customers->count(); $first = $customers->first(); $filtered = $customers->filter(fn ($c) => $c->orderCount > 10); // Find a customer by ID $customer = Printavo::customers()->find('abc123'); // Get the first customer $customer = Printavo::customers()->first();
Filtering
Each query builder has typed filter methods generated from the GraphQL schema.
use Brandonjjon\Printavo\Data\Generated\Enums\OrderPaymentStatus; use Brandonjjon\Printavo\Data\Generated\Enums\OrderSortField; // Filter by payment status (enum) $unpaid = Printavo::invoices() ->paymentStatus(OrderPaymentStatus::Unpaid) ->get(); // Filter by date range $invoices = Printavo::invoices() ->inProductionAfter('2024-01-01') ->inProductionBefore('2024-12-31') ->get(); // Sort results $invoices = Printavo::invoices() ->sortOn(OrderSortField::CustomerDueAt) ->sortDescending(true) ->get(); // Search with query string $invoices = Printavo::invoices() ->query('acme corp') ->get(); // Filter by status IDs (get IDs from Printavo::statuses()->get()) $statuses = Printavo::statuses()->get(); $invoices = Printavo::invoices() ->statusIds([$statuses->first()->id]) ->get();
Use your IDE's autocomplete to discover available filter methods for each resource.
Selecting Fields
Use field constants for type-safe field selection:
use Brandonjjon\Printavo\Data\Generated\Fields\CustomerFields; $customers = Printavo::customers() ->select([ CustomerFields::ID, CustomerFields::COMPANY_NAME, CustomerFields::ORDER_COUNT, ]) ->get();
Pagination
// Paginate results (cursor-based) $page = Printavo::customers()->paginate(25); // Access items foreach ($page->items() as $customer) { echo $customer->companyName; } // Get the next page if ($page->hasMorePages()) { $nextPage = Printavo::customers() ->cursor($page->getNextCursor()) ->paginate(25); }
Limiting Results
// Get only 10 customers $customers = Printavo::customers()->take(10)->get();
Creating Records
use Brandonjjon\Printavo\Data\Generated\CustomerCreateInput; $response = Printavo::customerMutations()->create( new CustomerCreateInput( companyName: 'Acme Corp', // ... other fields ) ); if ($response->successful()) { $customer = $response->data(); }
Updating Records
use Brandonjjon\Printavo\Data\Generated\CustomerInput; $response = Printavo::customerMutations()->update( 'customer-id', new CustomerInput( companyName: 'Acme Corporation', ) );
Deleting Records
$response = Printavo::customerMutations()->delete('customer-id');
Available Resources
Queries
| Method | Description |
|---|---|
contacts() |
Query contacts |
customers() |
Query customers |
inquiries() |
Query inquiries |
invoices() |
Query invoices |
merchStores() |
Query merch stores |
orders() |
Query orders |
paymentRequests() |
Query payment requests |
products() |
Query products |
quotes() |
Query quotes |
statuses() |
Query statuses |
tasks() |
Query tasks |
threads() |
Query threads |
transactions() |
Query transactions |
Mutations
| Method | Operations |
|---|---|
contactMutations() |
create, update, delete |
customerMutations() |
create, update, delete |
customAddressMutations() |
create, creates, update, updates, delete, deletes |
feeMutations() |
create, creates, update, updates, delete, deletes |
imprintMutations() |
create, creates, update, updates, delete, deletes |
invoiceMutations() |
update, delete, duplicate |
lineItemMutations() |
create, creates, update, updates, delete, deletes |
lineItemGroupMutations() |
create, creates, update, updates, delete, deletes |
quoteMutations() |
create, update, delete, duplicate |
taskMutations() |
create, update, delete |
threadMutations() |
update |
transactionPaymentMutations() |
create, update, delete |
| ...and more | See full API documentation |
DTOs
All responses are hydrated into typed Data Transfer Objects with IDE autocompletion support:
$customer = Printavo::customers()->find('abc123'); // All properties are typed echo $customer->id; // string echo $customer->companyName; // ?string echo $customer->orderCount; // ?int echo $customer->timestamps->createdAt; // ?Carbon
Error Handling
use Brandonjjon\Printavo\Exceptions\PrintavoException; use Brandonjjon\Printavo\Exceptions\RateLimitException; try { $customers = Printavo::customers()->get(); } catch (RateLimitException $e) { // Handle rate limit (only thrown if behavior is 'throw') } catch (PrintavoException $e) { // Handle API errors echo $e->getMessage(); }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
License
The MIT License (MIT). Please see License File for more information.
brandonjjon/laravel-printavo 适用场景与选型建议
brandonjjon/laravel-printavo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「laravel」 「eloquent」 「graphql」 「printavo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 brandonjjon/laravel-printavo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 brandonjjon/laravel-printavo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 brandonjjon/laravel-printavo 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Eloquent model trait for translatable resource
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Help to manage meta data on Laravel Eloquent model
A package to cast json fields, each sub-keys is castable
A PSR-7 compatible library for making CRUD API endpoints
Alfabank REST API integration
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-14