kawtharstudios / sf15to18
A PHP package to convert a 15 digit Salesforce ID to 18 digits
1.0.2
2026-01-19 00:55 UTC
Requires
- php: >=8.0
- illuminate/support: ^v9.0.0 || ^v10.0.0
Requires (Dev)
- phpunit/phpunit: ^10.0.0
README
Convert 15-character Salesforce IDs to their 18-character case-insensitive form.
Salesforce “classic” IDs are 15 chars and case-sensitive. The 18-char form adds a 3-character suffix so the ID becomes case-insensitive, which is safer for spreadsheets, exports, and integrations.
Requirements
- PHP: 8.0+
- Illuminate Support:
illuminate/support^9 or ^10
Installation
composer require kawtharstudios/sf15to18
Usage
<?php use KawtharStudios\SF15to18; $id18 = SF15to18::convert('001550V000WOQZi'); // 001550V000WOQZiACP
Behavior
- 18-character input: returned unchanged
- 15-character input: converted to 18 characters
- Invalid input: throws
Exception
<?php use KawtharStudios\SF15to18; SF15to18::convert('001550V000WOQZiACP'); // unchanged SF15to18::convert('not-a-salesforce-id'); // throws
Laravel
This package ships with a Laravel service provider and supports package auto-discovery.
If you’ve disabled discovery, add the provider manually:
KawtharStudios\KawtharStudiosServiceProvider::class,
Testing
./vendor/bin/phpunit
Contributing
- Bugs: include a minimal reproduction + expected vs actual result
- PRs: keep changes focused, add/update tests, and update docs when behavior changes
License
MIT — see LICENSE.md.