dgtlinf/payslip
Composer 安装命令:
composer require dgtlinf/payslip
包简介
Generate professional PDF payslips using salary data from dgtlinf/salary-calculator.
README 文档
README
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
- Payslip::for($salaryData) — accepts a salary result array from
SalaryCalculator - locale('en'|'sr') — sets the output language
- setPaymentDate(Carbon $date) — defines the payment date shown on the slip
- 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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dgtlinf/payslip 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Salary Grade schedule parser. Look up monthly salaries by grade and step.
Alfabank REST API integration
Paggy BoletoBundle
Salary Module for Wordpress
Filipino-localized fake-data generator — names, addresses (regions/provinces/cities), phones, government IDs, peso amounts, businesses, PH holiday/working-day dates, and full payslip fixtures (uses phdevutils/payroll).
Parse salary slip in images, get the salary amount
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-06