承接 dgtlinf/payslip 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dgtlinf/payslip

Composer 安装命令:

composer require dgtlinf/payslip

包简介

Generate professional PDF payslips using salary data from dgtlinf/salary-calculator.

README 文档

README

Latest Version on Packagist License

Professional Laravel package for generating multilingual PDF payslips.
Built on top of dgtlinf/salary-calculator, this package provides an elegant way to render, stream, or download payslips directly from salary calculator data arrays.

🚀 Features

  • 🇷🇸 Country-specific providers (currently: Serbia)
  • 🧾 PDF generation via barryvdh/laravel-dompdf
  • 🌍 Multilingual templates (English & Serbian)
  • ⚙️ Stream, download, or preview as HTML
  • 🧩 Simple integration with dgtlinf/salary-calculator
  • 🎨 Easily extendable with custom providers and templates

📦 Installation

composer require dgtlinf/payslip

This will also install dependencies like dgtlinf/salary-calculator and barryvdh/laravel-dompdf.

🧩 Configuration

Publish the configuration and templates if you want to customize them:

php artisan vendor:publish --provider="Dgtlinf\Payslip\PayslipServiceProvider"

This will publish:

  • config/payslip.php
  • Blade templates under resources/views/vendor/payslip/
  • Translations under lang/vendor/payslip/

⚙️ Usage Example

A typical usage example integrating with dgtlinf/salary-calculator:

use Dgtlinf\SalaryCalculator\Facades\SalaryCalculator;
use Dgtlinf\Payslip\Facades\Payslip;

$months = [
    ['date' => '2025-01-01', 'gross' => 420000],
    ['date' => '2025-02-01', 'gross' => 410000],
    ['date' => '2025-03-01', 'gross' => 435000],
];

$rate = \Dgtlinf\SalaryCalculator\Facades\AverageHourlyRate::calculate($months, 'RS');

$employee = new \Dgtlinf\SalaryCalculator\Models\EmployeeProfile(
    firstName: 'Milan',
    lastName: 'Jovanović',
    address: 'Kralja Petra 10, Beograd',
    idNumber: '0101990123456',
    bankAccount: '160-123456789-01',
    position: 'Software Engineer',
);

$employer = new \Dgtlinf\SalaryCalculator\Models\EmployerProfile(
    name: 'Digital Infinity DOO',
    taxId: '110217311',
    registrationNumber: '21318507',
    address: 'Bulevar Kralja Petra I 89, Novi Sad',
    bankName: 'Raiffeisen Bank',
    bankAccount: '265-0001234567890-00'
);

$context = new \Dgtlinf\SalaryCalculator\Models\SalaryContext(
    2025,
    9,
    'RS',
    vacationDays: 0,
    sickDays: 0,
    sickLeaveFullPay: false,
    yearsInService: 8,
    avgHourlyRateLast12Months: null,
    employee: $employee,
    employer: $employer
);

// Create a calculator instance
$calc = SalaryCalculator::for($context);

// Generate a payslip from net salary
$result = $calc->fromNet(80000);

// Render as HTML (useful for previews)
return Payslip::for($result)->toHtml();

// Or download as PDF
return Payslip::for($result)->download();

// Or stream directly to browser
return Payslip::for($result)->locale('en')->setPaymentDate(now())->stream();

⚙️ Config Overview

config/payslip.php

return [
    'default_country' => 'RS',
    'providers' => [
        'RS' => \Dgtlinf\Payslip\Providers\RS\RSPayslipProvider::class,
    ],
    'default_template' => 'default',
    'filename_format' => '{slug}_{year}_{month}_payslip.pdf',
];

🧩 How It Works

  1. Payslip::for($salaryData) — accepts a salary result array from SalaryCalculator
  2. locale('en'|'sr') — sets the output language
  3. setPaymentDate(Carbon $date) — defines the payment date shown on the slip
  4. toHtml() / download() / stream() — output options

All salary data is taken directly from the SalaryCalculator array — no additional DTOs or models are required.

🧠 Extending

To add a new country provider, extend the BasePayslipProvider class and register it in the config:

'providers' => [
    'DE' => \App\Payslip\Providers\GermanyPayslipProvider::class,
]

Then place your template under:

resources/views/vendor/payslip/DE/default.blade.php

and translations under:

lang/vendor/payslip/de/{locale}/payslip.php

📂 Directory Structure

src/
├── PayslipServiceProvider.php
├── PayslipGenerator.php
├── Facades/Payslip.php
├── Providers/
│   ├── BasePayslipProvider.php
│   └── RS/RSPayslipProvider.php
└── resources/
    ├── views/RS/default.blade.php
    └── lang/rs/{en,sr}/payslip.php

🏷 License

This package is open-sourced under the MIT License.

🧑‍💻 Author

Digital Infinity d.o.o. Novi Sad
Bulevar Kralja Petra I 89, 21000 Novi Sad, Serbia
www.digitalinfinity.rs

© 2025 Digital Infinity. All rights reserved.

dgtlinf/payslip 适用场景与选型建议

dgtlinf/payslip 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「payslip」 「salary」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 dgtlinf/payslip 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dgtlinf/payslip 我们能提供哪些服务?
定制开发 / 二次开发

基于 dgtlinf/payslip 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-06