IMEI Phone Ledger
WordPress plugin: purchase and sale ledger for second-hand phone shops, tracked by IMEI.
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/shahadul878/imei-phone-ledger/archive/refs/heads/master.zipA WordPress plugin for second-hand phone shops: a purchase and sale ledger where every phone is tracked by its IMEI.
- Record purchases (IMEI 1/2, phone details, seller with mobile and NID) and sales (buyer, price), with profit per phone.
- IMEI check-digit validation, live while typing. Bengali digits accepted everywhere.
- Duplicate protection: an IMEI already in stock is blocked; one sold before needs explicit confirmation.
- Search by IMEI, name, mobile, NID or model. Reports by date range. Excel-safe CSV export.

Shop owners and staff: read the User Guide. WordPress.org listing: see readme.txt.
Requirements
- WordPress 6.4+ (uses
%iin$wpdb->prepare()andwp_admin_notice()) - PHP 7.4+
- MySQL / MariaDB (uses
GET_LOCK()to serialise duplicate checks)
Project layout
imei-phone-ledger.php Bootstrap: constants, requires, hooks
uninstall.php Keeps data unless IMEI_LEDGER_DELETE_DATA is true
includes/
class-imei-ledger-*.php Pure rules (no WordPress needed): Digits, Imei, Money,
Validator, Duplicates, Query, Csv, Status
class-imei-ledger-installer.php Table (dbDelta) and capability
class-imei-ledger-repository.php All $wpdb access
admin/ Menu, screens, admin-post handlers, AJAX, list table
views/ Templates (all output escaped)
assets/ admin.css, admin.js (no build step)
tests/unit/ PHPUnit tests for the pure rules
docs/ User guide and screenshots
.wordpress-org/ WordPress.org screenshots (SVN assets/)
Business rules live in the pure classes so they can be tested without WordPress or a database. The repository is the only class that talks to $wpdb; admin classes only read requests and render views.
Development
composer install
composer test
Coding standards (WordPress ruleset; PHPCS with WPCS installed globally):
phpcs --standard=WordPress --extensions=php --ignore=vendor/*,tests/* .
Releasing
-
Bump the version in three places:
imei-phone-ledger.php: theVersion:header andIMEI_LEDGER_VERSIONreadme.txt:Stable tag:plus a== Changelog ==entry (and== Upgrade Notice ==if needed)- If the table schema changed:
Imei_Ledger_Installer::DB_VERSIONand theCREATE TABLESQL.dbDeltaruns automatically when the stored version differs.
-
Check: tests, PHPCS, then Plugin Check on the plugin.
wp plugin check imei-phone-ledger --exclude-directories=tests,vendor,docs --ignore-codes=hidden_files,application_detected,unexpected_markdown_file -
Build the zip.
wp dist-archivehonours.distignore, so tests, vendor, docs,.wordpress-organd Markdown files are left out.wp dist-archive wp-content/plugins/imei-phone-ledger -
Commit and tag:
git tag -a v1.0.1 -m "IMEI Phone Ledger 1.0.1" -
WordPress.org (SVN): copy the zip's contents to
trunk/and totags/<version>/, and the files in.wordpress-org/to the top-levelassets/directory.
Security notes
- Every state-changing request checks the
manage_imei_ledgercapability and a nonce (per record for delete and cancel-sale). - All SQL goes through
$wpdb->prepare(). Column names and sort order come from whitelists inImei_Ledger_Query. - CSV cells starting with
= + - @are prefixed with'. Digit columns get a leading tab so spreadsheets keep them as text. - The list page posts its export filters, so searched names, phones and NIDs do not end up in URLs.
License
GPL-2.0-or-later.