rolecode/php-minimax
Composer 安装命令:
composer require rolecode/php-minimax
包简介
README 文档
README
Library is still in development and is limited with features. More features will be added in the future.
Summary
Installation
You can install library with composer:
composer require rolecode/php-minimax
Examples of use
Basic setup
// Create minimax instance.
$minimax = new MinimaxClient( "YOUR_MINIMAX_CLIENT_ID", "YOUR_MINIMAX_CLIENT_PASSWORD", "YOUR_MINIMAX_USER_NAME", "YOUR_MINIMAX_USER_PASSWORD" );
// Retrieve organisations.
$organisations = $minimax->organisations->all();
// Organisation must be set before performing other calls.
$minimax->setOrganisationId( "YOUR_ORGANISATION_ID" );
Document numbering
$documentNumberingsAll = $minimax->documentNumberings->all();
$documentNumberingId = $documentNumberings[0]->DocumentNumberingId;
$documentNumberingRetrievedById = $minimax->documentNumberings->retrieve( $documentNumberingId );
Employees
$allEmployees = $minimax->employees->all();
$employeeId = $employees[0]->EmployeeId;
$employeeRetrievedById = $minimax->employees->retrieve( $employeeId );
Report templates
// List of request params: https://moj.minimax.si/SI/API/Help/Api/GET-api-orgs-organisationId-report-templates
$reportTemplatesAll = $minimax->reportTemplates->all( ['SearchString' => 'IR'] );
$reportTemplateId = $reportTemplates[0]->ReportTemplateId;
$reportTemplateRetrievedById = $minimax->reportTemplates->retrieve( $reportTemplateId );
Employees
$employeesAll = $minimax->employees->all();
$employeeId = $employees[0]->EmployeeId;
$employeeRetrievedById = $minimax->employees->retrieve( $employeeId );
Items
$items = $minimax->items->all( ['SearchString' => '111'] );
$itemRetrievedById = $minimax->items->retrieveById( "INSERT_ID" );
$itemRetrievedByCode = $minimax->items->retrieveByCode( "INSERT_CODE" );
// Prepare item and create it.
$item = new Item();
$item->Name = "Example item.";
$item->Code = 1;
$item->ItemType = ItemType::GOOD;
$item->VatRate = new mMApiFkField( 36 );
$item->Currency = new mMApiFkField( 7 );
$createdItem = $minimax->items->create( $item );
// Update item.
$item = $minimax->items->retrieveById( "INSERT_ID" );
$item->Name = "New item name";
$updatedItem = $minimax->items->update( $item );
// Delete item.
$minimax->items->delete( "ID" );
Vatrates
$vatRates = $minimax->vatRates->all();
$vatRateStandard = $minimax->vatRates->retrieveByCode( VatRateCode::STANDARD );
Issued invoice
$invoicesAll = $minimax->issuedInvoices->all();
$invoiceRetrievedById = $minimax->issuedInvoices->retrieveById( "INSERT_ID" );
// Create invoice.
// First prepare invoice rows.
$invoiceRows = [];
$row = new IssuedInvoiceRow();
$row->RowNumber = 1;
$row->Item = new mMApiFkField( "INSERT_ITEM_ID" );
$row->Quantity = 1;
$row->Price = 1;
$row->PriceWithVAT = 1.22;
$row->Value = $row->PriceWithVAT;
$row->VatRate = new mMApiFkField( $vatRateStandard->VatRateId );
$row->VATPercent = $vatRateStandard->Percent;
$invoiceRows[] = $row;
// Prepare invoice payments.
$invoicePayments = [];
$row = new IssuedInvoicePaymentMethod();
$row->PaymentMethod = new mMApiFkField( $paymentMethod->PaymentMethodId );
$row->AlreadyPaid = "D";
$invoicePayments[] = $row;
// Prepare invoice object.
$invoice = new IssuedInvoice();
$invoice->InvoiceType = "R";
$invoice->Customer = new mMApiFkField( $customer->CustomerId );
$invoice->DateIssued = date( Date::DATE_FORMAT );
$invoice->DateTransactionFrom = $invoice->DateIssued;
$invoice->DateTransaction = $invoice->DateIssued;
$invoice->DateDue = date( Date::DATE_FORMAT )( Date::DATE_FORMAT );
$invoice->IssuedInvoiceRows = $invoiceRows;
$invoice->IssuedInvoicePaymentMethods = $invoicePayments;
// Create invoice.
$invoice = $minimax->issuedInvoices->create( $invoice );
// Issue and generate pdf for invoice.
$invoice = $minimax->issuedInvoices->performAction( $invoice->IssuedInvoiceId, $invoice->RowVersion, "issueAndGeneratepdf" );
// Retrieve invoice document pdf.
$documentId = $invoice->Document->ID;
$documentAttachmentId = $invoice->InvoiceAttachment->ID;
$documentAttachment = $minimax->documentAttachments->retrieve( $documentId, $documentAttachmentId );
// Save file to disk.
file_put_contents($documentAttachment->FileName, $documentAttachment->getDecodedAttachmentData());
Licence
Library is made available under the MIT License (MIT). Please see License File for more information.
rolecode/php-minimax 适用场景与选型建议
rolecode/php-minimax 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 11 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 rolecode/php-minimax 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rolecode/php-minimax 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-11-05