Download the PHP package ziming/laravel-myinfo-sg without Composer
On this page you can find all versions of the php package ziming/laravel-myinfo-sg. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ziming/laravel-myinfo-sg
More information about ziming/laravel-myinfo-sg
Files in ziming/laravel-myinfo-sg
Package laravel-myinfo-sg
Short Description Laravel Package for Singapore MyInfo
License
Homepage https://github.com/ziming/laravel-myinfo-sg
Informations about the package laravel-myinfo-sg
Laravel MyInfo Singapore
A working PHP Laravel Package for MyInfo Singapore. With the annoying, time wasting hidden quirks of implementing it in PHP figured out.
Will Myinfo v4 be supported?
There is recently an announcement that there will be a new Myinfo version that replaces Myinfo v4.
Therefore, it is not mandatory to upgrade from Myinfo v3 to Myinfo v4 anymore. Which means I will not work on supporting Myinfo v4 unless I am too free (which most likely mean never)
So there is no need to email me to demand it anymore.
Hope everyone is happy with this good news :)
But if you want to make a PR to support Myinfo v4, I will be open to take a look at it
Installation
You can install the package via composer:
Followed by adding the following variables to your .env
file.
The values provided below are the ones provided in the official MyInfo nodejs tutorial.
Change them to the values you are given for your app.
Lastly, publish the config file
You may also wish to publish the MyInfo official nodejs demo app ssl files as well to storage/myinfo-ssl. You should replace these in your production environment.
Usage and Customisations
When building your button to redirect to SingPass. It should link to route('myinfo.singpass')
After SingPass redirects back to your Callback URI, you should make a post request to route('myinfo.person')
If you prefer to not use the default routes provided you may set enable_default_myinfo_routes
to false
in
config/laravel-myinfo-sg.php
and map your own routes. This package controllers will still be accessible as shown
in the example below:
During the entire execution, some exceptions may be thrown. If you do not like the format of the json responses.
You can customise it by intercepting them in your laravel application app/Exceptions/Handler.php
An example is shown below:
The list of exceptions are as follows
Lastly, if you prefer to write your own controllers, you may make use of LaravelMyinfoSgFacade
or LaravelMyinfoSg
to generate the
authorisation api uri (The redirect to Singpass link) and to fetch MyInfo Person Data. Examples are shown below
You may also choose to subclass GetMyinfoPersonDataController
and override its preResponseHook()
template method to
do logging or other stuffs before returning the person data.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
A donation is always welcomed (currently $0), especially if you or your employer makes money with the help of my packages. Which I am aware of a couple.
All versions of laravel-myinfo-sg with dependencies
ext-gmp Version *
ext-json Version *
ext-openssl Version *
archtechx/enums Version ^1.0
guzzlehttp/guzzle Version ^7.0
illuminate/contracts Version ^10.0||^11.0
spatie/laravel-package-tools Version ^1.4.3
web-token/jwt-framework Version ^4.0