var-lab/lexoffice-bundle
Composer 安装命令:
composer require var-lab/lexoffice-bundle
包简介
A Symfony bundle to integrate the lexoffice api.
README 文档
README
Introduction
This bundle integrates the lexoffice public API into Symfony, utilizing Symfony's serializer to convert API responses into objects. Compatible with Symfony 6.4.
Installation
- Download the Bundle
Add the bundle to your composer.json:
composer require var-lab/lexoffice-bundle
2. Register the Bundle
(should be done automatically by composer)
return [
// ...
VarLabIT\LexofficeBundle\VarLabITLexofficeBundle::class => ['all' => true],
];
3. Add configuration
Create the config file config/packages/var_lab_it_lexoffice.yaml with following content:
var_lab_it_lexoffice:
api_key: '%env(LEXOFFICE_API_KEY)%'
add the api key to your .env:
# ...
LEXOFFICE_API_KEY=<your-api-key>
Usage
The following API functions are currently covered:
- Contacts
- [x] fetch contact
- [x] create contact
- [x] update contact
- Invoices
- [x] create invoice
- [x] update invoice
- [x] fetch invoice
- [x] download invoice pdf
The lexoffice bundle is currently undergoing further development. Your own pull requests are welcome.
Contacts
Create a new contact:
<?php
use VarLabIT\LexofficeBundle\Entity\Address;
use VarLabIT\LexofficeBundle\Entity\Company as LexofficeCompany;
use VarLabIT\LexofficeBundle\Entity\Contact;
use VarLabIT\LexofficeBundle\Entity\ContactRole;
use VarLabIT\LexofficeBundle\Entity\Enum\AddressType;
use VarLabIT\LexofficeBundle\Entity\Enum\RoleType;
use VarLabIT\LexofficeBundle\Entity\Person;
use VarLabIT\LexofficeBundle\LexofficeClient;
class CityPageController extends AbstractController {
public function __construct(
private readonly CompanyRepository $companyRepository,
private readonly LexofficeClient $lexofficeClient,
)
{
}
private function getContactObject(Company $company): Contact
{
$contact = new Contact();
$contact
->setVersion(0)
->addRole(RoleType::CUSTOMER, new ContactRole())
->setCompany(
(new LexofficeCompany())
->setName($company->getName())
->addContactPerson(
(new Person())
->setFirstName($company->getGivenName())
->setLastName($company->getFamilyName())
->setEmailAddress($company->getInvoiceEmail())
->setPrimary(true)
->setPhoneNumber($company->getContactPhone())
),
)
->addAddress(
AddressType::BILLING,
(new Address())
->setSupplement('Rechnungsadresse')
->setStreet($company->getAddress())
->setZip($company->getZipcode())
->setCity($company->getCity())
->setCountryCode($company->getCountry())
);
return $contact;
}
public function createContact(int $companyId): Response {
$company = $this->companyRepository->find($companyId);
$contact = $this->createContact($company);
$contact = $this->lexofficeClient->createContact($contact);
$company
->setVersion($contact->getVersion())
->setLexofficeId($contact->getId());
}
}
Update a contact:
public function createContact(int $companyId): Response {
$company = $this->companyRepository->find($companyId);
$contact = $this->createContact($company);
$contact = $this->lexofficeClient->updateContact($contact);
$company
->setVersion($contact->getVersion())
->setLexofficeId($contact->getId());
}
Maintainer
This bundle is maintained and created by var-lab IT GmbH and contributors.
var-lab/lexoffice-bundle 适用场景与选型建议
var-lab/lexoffice-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.31k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 05 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 var-lab/lexoffice-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 var-lab/lexoffice-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2024-05-13