Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Testing and Contributing

Work in a source checkout of the NepalData package repository. The distributed archive contains the package and its documentation; the test suite and development tools come from the source repository.

Run the package checks

Use PHP 8.4 and Composer 2 for the standard development workflow:

composer install
composer test
composer test:unit
composer test:integration
composer analyse

test:unit exercises the standalone queries, records, and data. test:integration uses Orchestra Testbench to check the service provider, facade, dependency injection, and package metadata. composer test runs both suites. PHPStan analyzes the runtime against PHP 7.4 at its maximum level.

For formatting, install Laravel Pint on the development runtime and run its check from the package root:

composer global require "laravel/pint:^1.32"
pint --test

If pint is not on PATH, find Composer’s global bin directory with composer global config bin-dir --absolute. Omit --test to apply formatting. The preserved raw files are excluded from formatting and static analysis.

With Xdebug installed, generate a coverage report with:

XDEBUG_MODE=coverage composer test -- --coverage-filter src --coverage-text

What CI verifies

The v2 package workflow at .github/workflows/ci.yml verifies standalone consumer installs throughout the supported PHP range, runs unit and Laravel tests on the listed combinations, and checks that Composer archives include the source without bundled vendor dependencies or local configuration files. A standalone smoke test uses the autoloader of a separate consumer project without Laravel or PHPUnit.

The integrity tests fingerprint all ten original views (five per language) and rebuild each typed hierarchy from relationships. They catch changes in keys, spelling, order, or parent-child associations. Keep those checks intact when changing query code.

Report a data correction

Open a package issue with the affected language, source file or raw view, and exact record. For a proposed correction, include a dated official or authoritative reference and note the other language or views that could be affected. The v2 modernization preserved the existing snapshot deliberately; do not replace its spellings or records in a code-only change.

For behavioral bugs, include a minimal example, installed package version, PHP version, and Laravel version if applicable.

Maintain the package and the guide

Keep package runtime syntax compatible with PHP 7.4, preserve stable province and district IDs, and cover observable behavior with tests. If an approved change alters a source spelling, update the exact-name mapping in src/Internal/AdministrativeNames.php without changing the existing ID, and update the integrity expectations only for the intended data change.

Update the affected guide chapters and the constants appendix when the package contract changes. Use mdbook build from the guide directory to regenerate the HTML, and mdbook serve --open to preview edits. The editable Markdown lives in src/; do not edit generated files in book/.

The v2 source checkout contains CHANGELOG.md and CONTRIBUTING.md. See the release list for published versions.