PHPackages                             carropublic/myinfo - 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. [API Development](/categories/api)
4. /
5. carropublic/myinfo

ActiveLibrary[API Development](/categories/api)

carropublic/myinfo
==================

PHP Integrating with MyInfo

4.0.0(2y ago)098.7k↓33.3%2[1 issues](https://github.com/carro-public/myinfo/issues)[2 PRs](https://github.com/carro-public/myinfo/pulls)MITPHP

Since Dec 12Pushed 2y ago5 watchersCompare

[ Source](https://github.com/carro-public/myinfo)[ Packagist](https://packagist.org/packages/carropublic/myinfo)[ Docs](https://github.com/carropublic/myinfo)[ RSS](/packages/carropublic-myinfo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (10)Used By (0)

MyInfo
======

[](#myinfo)

[![Latest Version on Packagist](https://camo.githubusercontent.com/06df10c5e0a2155ca0d1661292f0bdbfa983ed4fd03447449e0f5af4b0a4fb23/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636172726f7075626c69632f6d79696e666f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/carropublic/myinfo)[![Total Downloads](https://camo.githubusercontent.com/4a20ef2c46a679f6c2f02aed9f916364b56974b1a22085c81bc5abb5f54a5947/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636172726f7075626c69632f6d79696e666f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/carropublic/myinfo)

This is a Laravel Pacakge for [MyInfo](https://www.ndi-api.gov.sg/library/trusted-data/myinfo/introduction). You can read more about MyInfo on their page. There is [\[PUBLIC\] Demo client application for integrating with MyInfo](https://github.com/jamesleegovtech/myinfo-demo-app) which was in Nodejs. So, I implemented my own for Laravel Package base on their Nodejs demo.

Take a look at [contributing.md](contributing.md) to see a to do list.

Installation
------------

[](#installation)

Via Composer

```
$ composer require carropublic/myinfo
```

Usage
-----

[](#usage)

Run `php artisan vendor:publish` which will move `private.pem` and `public.pem` to your `storage/ssl` folder. I got the private/public key pair from MyInfo demo page. You have to use your own

Setup Environment

```
MYINFO_AUTHORIZE_API="https://test.api.myinfo.gov.sg/com/v3/authorise"
MYINFO_TOKEN_API="https://test.api.myinfo.gov.sg/com/v3/token"
MYINFO_PERSON_API="https://test.api.myinfo.gov.sg/com/v3/person"
MYINFO_CALLBACK_URL="http://localhost:3001/callback"
MYINFO_CLIENT_ID="STG2-MYINFO-SELF-TEST"
MYINFO_CLIENT_SECRET="44d953c796cccebcec9bdc826852857ab412fbe2"
MYINFO_REALM="http://localhost:3001"
MY_INFO_PRIVATE_KEY="ssl/private.pem"
MY_INFO_PUBLIC_KEY="ssl/public.pem"
MYINFO_ATTRIBUTES="uinfin,name,sex,race,nationality,dob,email,mobileno,regadd,housingtype,hdbtype,marital,edulevel,noa-basic,ownerprivate,cpfcontributions,cpfbalances"
MYINFO_PURPOSE="demonstrating MyInfo APIs"

```

Usage,

You can create aturhoize URL something like the following.

```
MyInfo::createAuthorizeUrl($code); # $code in this case for state

```

When user agree to retrieve their info, then it's gonna redirect to `MYINFO_CALLBACK_URL` base on your configruation. Then you need to handle something like the following

```
// This is the state that you passed when creating authorize URL
$state           = $request->input('state');

// This is the authorizon code
$code           = $request->input('code');

// Create token request base on authorize code
$myInfoToken    = MyInfo::createTokenRequest($code);
$token          = json_decode($myInfoToken, true);

if (!$token) {
	// handle error when there is no token
}

$jwtPayload = MyInfo::getJWTPayload($token['access_token']);

if(!$jwtPayload) {
	// handle error when there is problem with getting JWT
}

$userUniFin = $jwtPayload['sub'];

// Create person request
$personRequest = MyInfo::createPersonRequest(
	$userUniFin,
	$token['access_token']
);

if(!$personRequest) {
	// handle error when there is problem with person request
}

// Get user data using private key
$userData = MyInfo::getUserData(
	$personRequest,
	storage_path(config('myinfo.keys.private'))
);

```

Change log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todo list.

Security
--------

[](#security)

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits
-------

[](#credits)

- [Carro.sg](https://github.com/carro-public)
- [All Contributors](../../contributors%5D)

License
-------

[](#license)

license. Please see the [license file](license.md) for more information.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 92.3% 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 ~317 days

Recently: every ~463 days

Total

7

Last Release

811d ago

Major Versions

1.0.3 → 2.0.02020-04-01

2.0.0 → 3.0.02020-10-26

3.0.0 → 4.0.02024-02-27

### Community

Maintainers

![](https://www.gravatar.com/avatar/e6091ff5fd542200ff600c7d9341743c5742a85e7f362e869fd4507ab30dfed1?d=identicon)[sithuaung](/maintainers/sithuaung)

![](https://www.gravatar.com/avatar/157df3dda57b84fda6cf5c2da53974dc7eb9299ce8e27fffb6b0b88112358491?d=identicon)[setkyar](/maintainers/setkyar)

![](https://www.gravatar.com/avatar/b0bc8b5edf29364378ce6409db415a1ce7d0a181adc40ab6c3603d83806ffb8b?d=identicon)[danielnguyen1612](/maintainers/danielnguyen1612)

![](https://www.gravatar.com/avatar/170e8e0e4b2ce9b2768af2b02ab22cb615ed0f591f18061c8ab3686c49596936?d=identicon)[carro-tech](/maintainers/carro-tech)

---

Top Contributors

[![setkyar](https://avatars.githubusercontent.com/u/4435358?v=4)](https://github.com/setkyar "setkyar (24 commits)")[![danielnguyen1612](https://avatars.githubusercontent.com/u/1705651?v=4)](https://github.com/danielnguyen1612 "danielnguyen1612 (2 commits)")

---

Tags

laravel-5-packagemyinfophplaravelMyInfo

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/carropublic-myinfo/health.svg)

```
[![Health](https://phpackages.com/badges/carropublic-myinfo/health.svg)](https://phpackages.com/packages/carropublic-myinfo)
```

###  Alternatives

[irazasyed/telegram-bot-sdk

The Unofficial Telegram Bot API PHP SDK

3.3k4.5M84](/packages/irazasyed-telegram-bot-sdk)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[dcblogdev/laravel-xero

A Laravel Xero package

53129.1k1](/packages/dcblogdev-laravel-xero)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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