PHPackages                             crmleaf/payslip-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. crmleaf/payslip-generator

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

crmleaf/payslip-generator
=========================

Compliance-ready payslip PDFs with your company branding.

v1.1.0(today)001[1 PRs](https://github.com/CrmLeaf/payslip-generator/pulls)MITPHPPHP ^8.2CI passing

Since Aug 13Pushed todayCompare

[ Source](https://github.com/CrmLeaf/payslip-generator)[ Packagist](https://packagist.org/packages/crmleaf/payslip-generator)[ Docs](https://www.indpayroll.com/free-tools/payslip-generator)[ RSS](/packages/crmleaf-payslip-generator/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (4)Used By (0)

Payslip Generator
=================

[](#payslip-generator)

Compliance-ready payslip PDFs with your company branding.

Builds a payslip for one employee for one wage month: earnings from the salary structure, statutory deductions computed by the core engine, and a net pay figure with the working attached to every line.

One of the [CRMLeaf payroll tools](https://github.com/crmleaf). The arithmetic and the dated statutory rate tables live in [`crmleaf/payroll-core`](https://github.com/crmleaf/payroll-core); this package is the thin skin that makes one calculator installable, mountable and embeddable on its own.

Note

A wrong figure or an out-of-date rate is almost always a [`payroll-core`](https://github.com/crmleaf/payroll-core/issues) matter, since that is where the tables live. Anything about this tool's routes, views or browser asset belongs here.

Install
-------

[](#install)

**Composer** - Laravel auto-discovers the service provider, so this is the whole setup:

```
composer require crmleaf/payslip-generator
```

**npm** - the same calculation, re-exported from `@crmleaf/payroll-js` so you can install this one tool and nothing else:

```
npm install @crmleaf/payslip-generator
```

Note

Not on npm yet. The script-tag route below needs no registry and works today. Installing this package straight from git will not resolve `@crmleaf/payroll-js`, which is not published yet either.

**A plain script tag** - no build step, no bundler, no server. Build the browser bundle once and serve the file yourself:

```

const result = CrmleafPayroll.payslip({
  employeeName: "Asha Menon",
  monthlyGross: 75000,
  monthlyBasic: 30000,
  payMonth: "2025-08-01",
});
console.log(result.explain);

```

`payroll.min.js` is the single-file browser build. Get it by running `npm run build` in [`@crmleaf/payroll-js`](https://github.com/crmleaf/payroll-js) and copying `dist/payroll.min.js`into whatever your site serves as static assets.

> A hosted CDN build is coming soon, which will reduce this to a single URL. Serving the file yourself works today and keeps working afterwards - it is the only option that needs no third-party request, so plenty of projects will want to stay on it.

### See it working first

[](#see-it-working-first)

`demo/index.html` in this repository is a working copy of Payslip Generator in one file: the form, the calculation and the working, with no build step and no server. Drop `payroll.min.js` beside it and open it from disk.

```
cp /path/to/payroll-js/dist/payroll.min.js demo/
open demo/index.html
```

Nothing on that page reaches the network, which is the point: it is a calculator people paste salary figures into.

Use it
------

[](#use-it)

**Plain PHP**, no framework and no container:

```
use Crmleaf\Payroll\Calculators\PayslipGenerator;
use Crmleaf\Payroll\Money;

$result = (new PayslipGenerator())->calculate(
    employeeName: 'Asha Menon',
    monthlyGross: Money::fromRupees(75_000),
    monthlyBasic: Money::fromRupees(30_000),
    payMonth: new \DateTimeImmutable('2025-08-01'),
);

echo $result->explain();      // the formula with the real operands in it
echo $result->workings();     // every step, one per line, with its citation
print_r($result->toArray());  // snake_case, ready for JSON
```

**Laravel** - resolve it from the container, or type-hint it anywhere:

```
use Crmleaf\Payroll\Calculators\PayslipGenerator;

public function show(PayslipGenerator $calculator)
{
    return $calculator->calculate(
        employeeName: 'Asha Menon',
        monthlyGross: Money::fromRupees(75_000),
        monthlyBasic: Money::fromRupees(30_000),
        payMonth: new \DateTimeImmutable('2025-08-01'),
    )->toArray();
}
```

**Blade** - one component, no controller:

```

```

**HTTP** - off by default. Publish the config and turn the route on:

```
php artisan vendor:publish --tag=payslip-generator-config
```

```
// config/payslip-generator.php
'route' => ['enabled' => true, 'prefix' => 'tools'],
```

```
curl -X POST https://example.test/tools/payslip-generator \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"employee_name":"Asha Menon","monthly_gross":75000,"monthly_basic":30000,"pay_month":"2025-08-01"}'
```

The JSON response carries the figures, the working and the statutory citations:

```
{
  "tool": "payslip-generator",
  "data": { "…": "every figure, snake_case, with a *_formatted twin" },
  "explain": "the formula with the real operands substituted",
  "working": [{ "label": "…", "amount": 0, "formula": "…", "citation": "…" }],
  "citations": ["…"]
}
```

**JavaScript**:

```
import { payslip } from '@crmleaf/payslip-generator';

const result = payslip({
  employeeName: "Asha Menon",
  monthlyGross: 75000,
  monthlyBasic: 30000,
  payMonth: "2025-08-01",
});
```

Documents render inside your application
----------------------------------------

[](#documents-render-inside-your-application)

This tool writes a PDF file, which means it needs a server. Rendering happens in **your** application, against **your** published config, and the bytes never leave your infrastructure - there is no hosted document service and therefore no credential for a browser to carry.

```
composer require dompdf/dompdf
php artisan vendor:publish --tag=payslip-generator-config   # company name, address, GSTIN, logo
```

```
use Crmleaf\Payroll\Tools\PayslipGenerator\Documents\PayslipGeneratorDocument;

return app(PayslipGeneratorDocument::class)->download($result, 'payslip-generator.pdf');
```

Add `format=pdf` to the HTTP request and the route returns the file directly.

Inputs
------

[](#inputs)

FieldTypeRequiredDefaultNotes`employee_name`stringYes`"Asha Menon"``employee_code`stringNo`"EMP-0001"``designation`stringNo`"Senior Engineer"``monthly_gross`money (₹)Yes`75000``monthly_basic`money (₹)Yes`30000``pay_month`date (YYYY-MM-DD)Yes`"2025-08-01"`Any date within the month being paid; the first of the month is conventional.`days_payable`integerNo`31``lop_days`integerNo`0``state`stringNo`"Karnataka"`Decides which professional tax schedule applies.`as_of`date (YYYY-MM-DD)No-Leave blank for current rates. Set it to recompute an old payslip on the rates that were in force then.Optional fields you leave out are omitted from the call entirely, so the calculator's own documented defaults apply.

Every figure here rests on a statutory rate, so the call takes `as_of`. Set it and the calculation runs on the rates in force on that date, which is what makes a prior year recomputable rather than merely rememberable.

Statutory basis
---------------

[](#statutory-basis)

Payment of Wages Act 1936, section 13A and the Code on Wages 2019 - the particulars a wage slip must carry - with EPF, ESI and professional tax deducted per their own enactments.

Rates are data, not code: they live in dated tables with a cited source in `crmleaf/payroll-core`, so a rate change is a new dated entry rather than an edit to a constant.

Important

This package implements our reading of the applicable statutes and is provided without warranty. It is a calculation library, not tax advice. Verify against your own compliance obligations before relying on the output for statutory filing.

Publishing
----------

[](#publishing)

TagPublishes`payslip-generator-config``config/payslip-generator.php``payslip-generator-views``resources/views/vendor/payslip-generator``payslip-generator-assets``public/vendor/payslip-generator`Licence
-------

[](#licence)

[MIT](LICENSE) © CRMLeaf. Use it commercially, embed it, fork it.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance100

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/315788704?v=4)[crmleaf](/maintainers/crmleaf)[@CrmLeaf](https://github.com/CrmLeaf)

---

Top Contributors

[![andolasoftuser196](https://avatars.githubusercontent.com/u/145565449?v=4)](https://github.com/andolasoftuser196 "andolasoftuser196 (13 commits)")[![soumya-andola](https://avatars.githubusercontent.com/u/105414367?v=4)](https://github.com/soumya-andola "soumya-andola (1 commits)")

---

Tags

indialaravelpayrollpayslippdfsalary-sliplaravelpdfindiapayrollpayslipsalary-slip

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/crmleaf-payslip-generator/health.svg)

```
[![Health](https://phpackages.com/badges/crmleaf-payslip-generator/health.svg)](https://phpackages.com/packages/crmleaf-payslip-generator)
```

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k104.2M441](/packages/barryvdh-laravel-dompdf)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k27.1M53](/packages/barryvdh-laravel-snappy)[paperdoc-dev/paperdoc-lib

A zero-dependency PHP library for generating, parsing and converting documents — PDF, DOCX, XLSX, PPTX, HTML, Markdown, CSV and legacy Office formats

1315.4k](/packages/paperdoc-dev-paperdoc-lib)[lucasromanojf/laravel5-pdf

Provides the HTML2PDF functionality using the wkhtmltopdf library (Laravel 5)

1272.5k](/packages/lucasromanojf-laravel5-pdf)[initred/laravel-tabula

laravel-tabula is a tool for liberating data tables trapped inside PDF files for the Laravel framework.

1418.6k](/packages/initred-laravel-tabula)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
