PHPackages                             crmleaf/salary-templates - 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/salary-templates

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

crmleaf/salary-templates
========================

Editable Excel templates: salary structure, register, slip and master.

v1.0.0(today)00[1 PRs](https://github.com/CrmLeaf/salary-templates/pulls)MITPHPPHP ^8.2CI passing

Since Aug 14Pushed todayCompare

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

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

Salary Templates
================

[](#salary-templates)

Editable Excel templates: salary structure, register, slip and master.

Generates the four spreadsheets a payroll team actually keeps - salary structure, monthly register, salary slip and employee master - already carrying the statutory columns and the formulae between them.

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/salary-templates
```

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

```
npm install @crmleaf/salary-templates
```

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.salaryTemplates({ template: "structure" });
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 Salary Templates 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\SalaryTemplateBuilder;
use Crmleaf\Payroll\Money;

$result = (new SalaryTemplateBuilder())->calculate(
    template: 'structure',
);

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\SalaryTemplateBuilder;

public function show(SalaryTemplateBuilder $calculator)
{
    return $calculator->calculate(
        template: 'structure',
    )->toArray();
}
```

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

```

```

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

```
php artisan vendor:publish --tag=salary-templates-config
```

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

```
curl -X POST https://example.test/tools/salary-templates \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"template":"structure"}'
```

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

```
{
  "tool": "salary-templates",
  "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 { salaryTemplates } from '@crmleaf/salary-templates';

const result = salaryTemplates({ template: "structure" });
```

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

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

This tool writes a XLSX 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 phpoffice/phpspreadsheet
php artisan vendor:publish --tag=salary-templates-config   # company name, address, GSTIN, logo
```

```
use Crmleaf\Payroll\Tools\SalaryTemplates\Documents\SalaryTemplateBuilderDocument;

return app(SalaryTemplateBuilderDocument::class)->download($result, 'salary-templates.xlsx');
```

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

Inputs
------

[](#inputs)

FieldTypeRequiredDefaultNotes`template`one of `structure`, `register`, `slip`, `master`Yes`"structure"``employee_count`integerNo`25``annual_ctc`money (₹)No`1200000`Used to fill the worked example row.`state`stringNo`"Karnataka"``as_of`date (YYYY-MM-DD)No-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 rule 27 of the Code on Wages (Central) Rules 2021 for the register formats; the wage slip particulars of section 13A for the slip layout.

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`salary-templates-config``config/salary-templates.php``salary-templates-views``resources/views/vendor/salary-templates``salary-templates-assets``public/vendor/salary-templates`Licence
-------

[](#licence)

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

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

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 (8 commits)")

---

Tags

excelindiasalary-registersalary-structuretemplatesxlsxexcelxlsxtemplatesindiasalary-structuresalary-register

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/crmleaf-salary-templates/health.svg)

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

###  Alternatives

[phpoffice/phpspreadsheet

PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine

14.0k327.3M1.7k](/packages/phpoffice-phpspreadsheet)[rap2hpoutre/fast-excel

Fast Excel import/export for Laravel

2.3k27.7M55](/packages/rap2hpoutre-fast-excel)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.2k75.4M291](/packages/openspout-openspout)[mk-j/php_xlsxwriter

PHP Library to write XLSX files

1.9k8.8M33](/packages/mk-j-php-xlsxwriter)[shuchkin/simplexlsx

Parse and retrieve data from Excel XLSx files. MS Excel 2007 workbooks PHP reader.

1.8k4.3M36](/packages/shuchkin-simplexlsx)[shuchkin/simplexlsxgen

Export data to Excel XLSx file. PHP XLSX generator.

1.1k2.5M42](/packages/shuchkin-simplexlsxgen)

PHPackages © 2026

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