ashraam/pennylane-laravel
Composer 安装命令:
composer require ashraam/pennylane-laravel
包简介
Pennylane API wrapper for Laravel
README 文档
README
Please read the official API documentation to know what are the required fields for each endpoint.
Installation
You can install the package via composer:
composer require ashraam/pennylane-laravel
Then add the Pennylance API KEY in the .env file.
PENNYLANE_API_KEY=my_api_key
Usage
List all customers
$customers = PennylaneLaravel::customers()->list();
Get a customer by it's ID
$customer = PennylaneLaravel::customers()->get(999);
Create a new customer
$customer = PennylaneLaravel::customers()->create([ 'source_id' => (string) 1, 'customer_type' => 'individual', 'first_name' => 'John', 'last_name' => 'Doe', 'gender' => 'mister', 'address' => "Street", 'postal_code' => 'zip code', 'city' => 'City', 'country_alpha2' => 'FR', 'emails' => ['john.doe@gmail.com'], 'phone' => '+33625478510' ]);
Update a customer
$customer = PennylaneLaravel::customers()->update(1, [ 'delivery_address' => 'Delivery address', 'delivery_postal_code' => 'Delivery zip code', 'delivery_city' => 'Delivery city', 'delivery_country_alpha2' => 'FR' ]);
List all products
$products = PennylaneLaravel::products()->list();
Get a product by it's ID
$product = PennylaneLaravel::products()->get(1);
Create a new product
$product = PennylaneLaravel::products()->create([ 'source_id' => (string) 1, 'label' => 'Product 1', 'unit' => 'piece', 'price_before_tax' => 10, 'price' => 12, 'vat_rate' => 'FR_200', 'currency' => 'EUR', 'reference' => 'ref-001' ]);
Update a product
$product = PennylaneLaravel::products()->update(1, [ 'description' => 'Updated description' ]);
List all invoices
$invoices = PennylaneLaravel::invoices()->list(); // Invoices can be filtered $invoices = PennylaneLaravel::invoices()->list([ [ 'field' => 'customer_id', 'operator' => 'eq', 'value' => (string) 1 ], [ 'field' => 'status', 'operator' => 'eq', 'value' => 'draft_status' ] ]);
Get an invoice by it's ID
$invoice = PennylaneLaravel::invoices()->get('RNT9MXHXAD');
Create an invoice
Second and third default value is set to false
$invoice = PennylaneLaravel::invoices()->create([ 'date' => today()->format('Y-m-d'), 'deadline' => today()->addDays(15)->format('Y-m-d'), 'draft' => false, 'customer' => [ 'source_id' => (string) 1 ], 'line_items' => [ [ 'label' => "My special item", 'quantity' => 3, 'product' => [ 'source_id' => (string) 1 ] ], [ 'label' => "Remise", 'quantity' => 1, 'currency_amount' => -10, 'unit' => 'piece', 'vat_rate' => 'FR_200' ] ] ], $create_customers = false, $create_products = false);
Import an invoice
Third default value is set to false
$invoice = PennylaneLaravel::invoices()->import([ 'date' => today()->format('Y-m-d'), 'deadline' => today()->addDays(15)->format('Y-m-d'), 'invoice_number' => 'F-874', 'currency' => 'EUR', 'customer' => [ 'source_id' => (string) 1 ], 'line_items' => [ [ 'label' => "My special item", 'quantity' => 3, 'product' => [ 'source_id' => (string) 1 ] ], [ 'label' => "Remise", 'quantity' => 1, 'currency_amount' => -10, 'unit' => 'piece', 'vat_rate' => 'FR_200' ] ] ], $file_url, $create_customer = false);
List all estimates
$estimates = PennylaneLaravel::estimates()->list();
Get an estimate by it's ID
$estimate = PennylaneLaravel::estimates()->get('VVAWLPY8QB');
Create a new estimate
$estimate = PennylaneLaravel::estimates()->create([ 'date' => today()->format('Y-m-d'), 'deadline' => today()->addDays(15)->format('Y-m-d'), 'customer' => [ 'source_id' => (string) 1 ], 'line_items' => [ [ 'label' => "My special item", 'quantity' => 3, 'product' => [ 'source_id' => (string) 1 ] ], [ 'label' => "Random line", 'quantity' => 1, 'currency_amount' => 17.85, 'unit' => 'piece', 'vat_rate' => 'FR_200' ] ] ]);
Get an enum
The second parameter default value is en
$values = PennylaneLaravel::enums()->get('unit', 'fr');
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email romain.bertolucci@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
ashraam/pennylane-laravel 适用场景与选型建议
ashraam/pennylane-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 288 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 07 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「invoices」 「customers」 「Pennylane」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ashraam/pennylane-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ashraam/pennylane-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ashraam/pennylane-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Space invoices PHP sdk
A Laravel package to easily integrate Xendit payment gateway. It supports credit and debit cards, and e-wallet payments and custom invoices, queued notifications, webhook listeners and more.
A modern, strictly typed, and extensible invoice generator for Laravel 12+ built with PHP 8.4 syntax. This package provides a clean builder pattern API, immutable data objects, and modular design inspired by LaravelDaily/laravel-invoices but rewritten from scratch with SOLID principles and Laravel b
A pdf of an orders does not equal an invoice, invoices should be: Immutable, sequentialy numbered. Commerce Invoices allows you to create moment-in-time snapshots of a order to create a invoice or credit invoice
PHP API Client for Asset Storage service of Customer's Canvas web-to-print system.
A PHP (and Laravel) package to interface with the Snipcart api.
统计信息
- 总下载量: 288
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-07-15